sysend.js
sysend.js copied to clipboard
Use localstorage option in sysend
Hi, great library.
It would be nice if we can tell sysend to use localStorage instead of BroadcastChannel throgh options.
The use case is offline web application that run from filesystem.
Thanks
Do you mean file:// protocol or something else?
Does BroadcastChannel throw some kind of error when used from filesystem? If that's the case I can easily use localStorage as a fallback. With this you will not need to specify the option, it will work out of the box.
I think that I can add this API:
sysend.setup({ mode: 'localStorage' });
// or
sysend.useLocalStorage();
New API added in version 1.14.0
Hi, yes file:// protocol exactly.
Sorry for not responding saw the comments only now.
BroadcastChannel didn't throw any errors as I remember.
I'll investigate and get back.
Thank you very much for this option.
I just checked the file:// protocol and it works without issues. Just open demo.html in the browser.
But the option will also be useful. I'll update the demo to be able to turn off BroadcastChannel for testing.
I've updated the demo to allow to turn off the localStorage and fix the parsing of file:// protocol because it was giving a warning from the proxy iframe.