简体   繁体   中英

localStorage access between two google app scripts deployed as web apps

I am trying to handover a string from GAS_web_app_A to GAS_web_app_B. GAS_web_app_B gets launched from a button on GAS_web_app_A's UI.

As localStorage is supposed to be accessible across the same origin, I stored 'stuff' from GAS_web_app_A and tried to read it from GAS_web_app_B - in the same browser - chrome.

But GAS_web_app_B is not able to read this 'stuff' stored by GAS_web_app_A.

1) do all google app scripts that are deployed as a web apps get resolved by browser's localStorage as being from the same origin?

step 1 : launch GAS_web_app_A via its URL - https: //script.google.com/a/macros/XXXX.com/s//dev

step 2 : localStorage.setItem("stuff", stuff);

step 3 : launch GAS_web_app_B via its URL - https: //script.google.com/a/macros/XXXX.com/s//dev (from GAS_web_app_A)

step 4 : console.log( 'stuff is ' + localStorage.getItem("stuff") );

I always get null in step 4. ( I am able to retrieve 'stuff' from GAS_web_app_A even after a reload though... )

Is this supposed to work or am I missing something trivial?

absolutely not supposed to work. it would be a huge security issue. look into passing url parameters to the 2nd script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM