Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

localStorage in Mac doesn't share the data between Word, Excel and PowerPoint add-ins #3159

Open
repl-minatee-p opened this issue Feb 16, 2023 · 12 comments
Assignees
Labels
Area: add-ins platform Issue related to the add-ins platform

Comments

@repl-minatee-p
Copy link

repl-minatee-p commented Feb 16, 2023

I have defined the Word, Excel and PowerPoint add-ins in one manifest.xml file. I am using localStorage to share data between these Word, Excel and PowerPoint add-ins. It works fine in Windows but not in Mac. In Mac, the data are shared between the same app add-ins but not across the apps add-ins. For example, if I store data in the localStorage of word add-in then it gets shared with all other word add-ins but not with excel and powerpoint add-ins.

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: Mac
  • Host [Excel, Word, PowerPoint, etc.]: Word, Excel, PowerPoint
  • Office version number: 16.69.1
  • Operating System: Mac OS

Expected behavior

I expect localStorage.getItem(key) in Excel and PowerPoint add-ins should get the value set in Word add-in using localStorage.setItem(key, value) and vice versa. It works fine in Windows but not in Mac.

Current behavior

Word add-in localStorage data are not shared with Excel and PowerPoint add-ins and vice versa.

Context

My add-in customers need data to be shared between Word, Excel and PowerPoint add-ins.

@ghost ghost added the Area: Word Issue related to Word add-ins label Feb 16, 2023
@ghost ghost added the Needs: attention 👋 Waiting on Microsoft to provide feedback label Feb 16, 2023
@ghost
Copy link

ghost commented Feb 16, 2023

Thank you for letting us know about this issue. We will take a look shortly. Thanks.

@penglongzhaochina
Copy link

Hi @jargil could you please take a look this issue?

@alexuaua
Copy link

Hello @penglongzhaochina ! I am encountering the same issue. I was going to open a new issue, but found that this one already addresses the same problem.
Could you please update me if there are any updates on this matter? Thank you!

Steps to Reproduce:

  • Generate a new add-in using "yo office, taskpane type with Excel, TypeScript.
  • In the manifest.xml, add "Document" to the Hosts, replicate the Host (type: Workbook) within VersionOverrides/Hosts (the duplicate type is set to "Document").
  • The add-in launches in both Word and Excel, but unlike in Windows, localStorage is not shared.

It appears that Office apps might isolate add-ins per application (and do not utilize GroupContainers unlike some other features). This particular distinction from Windows is not documented, and it would be really great if Mac apps allow an add-in to share localStorage/indexedDB across different hosts, given that the add-in ID and origin remain consistent, as we are using the same manifest.xml.

@macabacus-sd
Copy link

@msftbot @penglongzhaochina I have the same issue on Excel for Mac. The problem does not occur for me on Windows.

@penglongzhaochina
Copy link

penglongzhaochina commented Nov 3, 2023

Hi all,

Could you please check whether the local storage key which the add-in want to get are really there? If the local storage key really are there you can paste the error message which the API can't get the local storage content to here. It would be very helpful,Thanks!

@alexuaua
Copy link

alexuaua commented Nov 7, 2023

Hi @penglongzhaochina,

No, when I check the storage key in a different host application, it is not present (for example, a key set in Excel does not appear when checked in Word). There is no error message; in both applications, localStorage (as well as other browser APIs like indexedDB) functions correctly, but they operate independently, unlike on Windows.

@penglongzhaochina
Copy link

penglongzhaochina commented Nov 9, 2023

Can below link give you some insights? This issue may be similar with your scenario. Could you please go through this link to check whether your issue is related with this issue. having a workaround there.

https://github.com/OfficeDev/office-js-docs-pr/issues/4249

@macabacus-as
Copy link

@penglongzhaochina, thanks, but the issue discussed in the issue you provided a link for is about the Dialog API and online platform (and thus the storage partitioning applies).
The issue reported by @repl-minatee-p (we also observe) only relates to the Office for Mac - Office for Windows apps do not separate storage for the same add-in running in different apps.

@penglongzhaochina
Copy link

Hi all,

This is a by-design behavior on mac.

@penglongzhaochina penglongzhaochina removed the Needs: attention 👋 Waiting on Microsoft to provide feedback label Nov 16, 2023
@alexuaua
Copy link

Hi @penglongzhaochina,

  1. Is the behavior observed on Windows hosts indicative of a bug? I am uncertain as to why there is a need for separate storage when the add-in is identical.
    However, if this is a security-related issue, I would appreciate guidance on whether to report this as a problem for the Windows application and as a documentation issue. Specifically, the section titled 'Persist add-in state and settings' suggests that localStorage can be utilized to maintain the state of the add-in.

  2. Additionally, there is OfficeRuntime.Storage interface. The documentation indicates that this should be accessible across different hosts (and even different add-ins from the same domain), with a storage limit of 10 MB per domain, potentially shared by multiple add-ins. According to the documentation, this interface is expected to provide consistent values for an add-in from the same domain. However, on Mac, this is not the case.

@penglongzhaochina
Copy link

Hi @jargil ,

could you please help explain this issue?

@alexuaua
Copy link

I just found this issue seems to be related: #2928 (and covers OfficeRuntime.Storage).

@stevefengjin stevefengjin added Area: add-ins platform Issue related to the add-ins platform and removed Area: Word Issue related to Word add-ins labels May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: add-ins platform Issue related to the add-ins platform
Projects
None yet
Development

No branches or pull requests

7 participants