Reputation: 5510
I am building an Excel add-in with JavaScript API.
The add-in can popup a browser window by
popup = window.open("https://localhost:3000/#/new", "popup", "status=1, location=1, width=1000, height=1200");
I have tested that the add-in and the popup browser window could communicate by postMessage
.
However, it seems that they do NOT share the same localStorage
. For exemple, if i set localStorage.setItem("item", "content")
in the webpage, localStorage.getItem("item")
in the add-in returns null
.
Does anyone know if the add-in and the popup browser window share the same localStorage?
PS: I have tested that an add-in itself can set an item in localStorage
and get the value. Also, webpages can set and get items in localStorage
even though they may be in the same browser window.
Upvotes: 3
Views: 519
Reputation: 129
I think you could use something like SignalR to communicate between the two, if you're working in asp.net. If you are working in a different environment like node a standard websocket approach should work.
Upvotes: -1
Reputation: 8670
They do not (on Office for Windows). They run in different trust modes, do cookies, localStorage, etc. are not shared.
If you need a popup-like scenario, that is what the DialogAPI is for.
Upvotes: 2