Closed erikdemarco closed 4 years ago
This is by design. Script storage only exists for that script. It's another security measure that might indeed be a bit annoying if you're not actually downloading external scripts.
I'm not actually sure how to pass data between different scripts right now. I'll take a look at it tomorrow since I can't imagine I didn't build anything that could do this.
Also if there's anything specific you're building I might be able to help with that use case. If you're just toying around and experimenting that's fine as well.
Turns out I really didn't implement anything for this. A workaround might be to use the comm API to communicate between scripts. If a script is only running for a short while, you could create background pages for them and communicate between those.
Hi thank you for the update. I worked with this issue by implementing my own storage system via my website api using ajax. so it can work cross browser as well.
Btw, I have another problem. When using jquery library inside script. Why I cant use jquery function? how to make sure jquery library loaded?
That probably has to do with how you're loading the library. The best way is to go to the "libraries" tab of a script and to input the jQuery URL. It should then be accessible at window.$
, window.jQuery
or $
as you expect.
I have 2 script:
//Script 1: Copy var value = getSelection().toString(); crmAPI.storage.set("textSelection", value); //console.log( crmAPI.storage.get("textSelection") ); //it shows the data!
//Script 2: Paste console.log( crmAPI.storage.get("textSelection") ); //it shows "undefined"
Why crmAPI.storage.get doesnt work cross script? if i put crmAPI.storage.get in the same script as crmAPI.storage.set , it will work