Make the add-on and its browser popup with the same local storage?

I am creating an Excel add-in with JavaScript API.

The add-on can pop up in the browser window using

popup = window.open("https://localhost:3000/#/new", "popup", "status=1, location=1, width=1000, height=1200");

      

I have tested that the add-on and browser popup can communicate postMessage

.

However, it looks like they are NOT using the same localStorage

. For example, if I install localStorage.setItem("item", "content")

on a web page, localStorage.getItem("item")

the add-in will return null

.

Does anyone know if the add-on and browser popup support the same localStorage?

PS: I tested that the add-in can set an element to localStorage

and get a value. In addition, web pages can install and receive items in localStorage

, even though they can be in the same browser window.

+3


source to share


2 answers


They don't work (in Office for Windows). They work in different trust modes, cookies, localStorage, etc. not .



If you want a popup script, you need DialogAPI for that.

+2


source


I think you could use something like SignalR to communicate between the two if you are working in asp.net. If you are working in another environment like node the standard web layout approach should work.



-1


source







All Articles