6

I wrote an Excel add-in using the OfficeJS API about a year and a half ago and it has been working until about two weeks ago. It seems like Excel has had an update where I'm now allowed to right click on the taskpane and see dev tools, where I wasn't able to do that before and had to run an external MS Edge devtools application for debugging. This seems like a relatively new issue and I can't seem to find any information about it. I tried reducing MS Edge's Tracking prevention settings to the Basic setting as seen below:

tracking settings for MS Edge

I gave javascript permission to appsforoffice.microsoft.com since devtools is saying it's blocking this this file specifically https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js in the console. I also included just microsoft.com as well as the company's URL and cdn url. I also added localhost since this is happening locally on my computer too. I can't seem to change any blocking settings in Excel specifically, but my assumption is that excel runs an instance of Edge for the add-in since I can track it in Edge devtools.

I read the article found here https://learn.microsoft.com/en-us/microsoft-edge/web-platform/tracking-prevention in order to see what I could change, but none of the solutions here worked for me. It almost seems like the settings for Edge aren't getting read into Excel so it always blocks any application that attmeps to read from localStorage/sessionStorage.

I use sessionStorage in my add-in to write data to to read back out and tried localStorage too, but I still get the same error.

Even stranger, the data I'm attempting to read out is from data I've written to the storage and can see that it's been written with no problem when I look at the storage tab in devtools so the problem is limited to just reading from the storage.

Does anyone know where the changes to the tracking needs to be made for Excel add-ins to be able to read from the storage if these changes don't get updated from MS Edge or if there is a new bug that was released with Excel recently?

EDIT: To be more clear about the exact issue, my add in basically reads text and values from the cells and based on tags I've defined for the users, these values will be output in an HTML element containing the tags the user wants to generate. For example, when a user wants a paragraph, they can mark a cells with /para and /end para and any text and values in the rows/cells between that will be output in an HTML paragraph tag. They can also build out HTML tables like this. During the process of reading in the text and values, this all gets built out into a string called previewString that I store in sessionStorage so a Dialog window can open and read previewString from sessionStorage and will be the completed HTML the user wants to generate. All of this has been working now for about a year and a half, but now when attempting to generate the HTML, I can see the string is stored in sessionStorage as shown in the screen shot below:

sessionStorage

However, when the dialog window opens, the data is not in the sessionStorage so it can't be read and it still has the error Tracking Prevention blocked access to storage for https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js as well as a Permission Denied error.

enter image description here

previewString is not available in the sessionStorage tab for this dialog

enter image description here

SECOND EDIT: I searched the error code the console was giving OSF.DDA.ERROR code 7000, permission denied and found this post on SO Office JS Api - Permission Denied Issue. This appears to have been a bug in the past, but I'm not sure if this is the case again or not.

WTFranklin
  • 2,454
  • 4
  • 21
  • 28
  • It is not clear what the problem is. You mention "same error" but you don't say what it is. Please specify what you expect/want to happen and what happens instead. What steps lead up to the error and what exactly is the error? – Rick Kirkham Apr 05 '21 at 22:05
  • Hi @RickKirkham I updated my question to be more clear. I added some more screenshots to show the sessionStorage states between the panel and the dialog and the warning/error I'm seeing. – WTFranklin Apr 06 '21 at 13:58
  • 1
    This looks like a bug. Please raise an issue on the [Office JS repo](https://github.com/OfficeDev/office-js/issues). – Rick Kirkham Apr 08 '21 at 17:34
  • Thank you @RickKirkham. I'll do that – WTFranklin Apr 08 '21 at 19:02
  • 1
    @Frank, are you still experiencing this problem? I think I've encountered the same issue on one of my users machines. Everybody else seems fine. I've checked and they are fully updated on Edge. It is _something_ to do with that hostInfoValue in session storage, and something to do with the hand-off between Word and the Addin (i.e. sometimes the initial url for my addin has _host_info query param, and sometimes doesn't - if it does, then this issue occurs). – RichS Apr 22 '21 at 11:09
  • 1
    @RichS I'm still having the issue but now it seems local to my computer only. One of my clients who was having the issue sent me her computer and by the time it got here something had updated and her computer works perfectly now. I tried updating my version of Excel and still have the issue on Version 2103 (Build 13907.20400) and got her computer on the same version, but her computer was still working fine. Have you noticed your Add-in works for Word online? The add-in works for Excel online for me so I wonder if the issue is something deeper than the browser. – WTFranklin Apr 22 '21 at 13:32
  • 1
    Yes, it works correctly for online Word. It seems like a certain combination of versions Word/Edge/Windows that causes the problems. Unfortunately my problem seems to be getting worse. I've had an additional 5 customers contact me today that it has stopped working. I wish there was a way to fix it, but it feels like a MS problem. On one machine I managed to get it working by; 'right-click > inspect > application > session storage > 'clear' on my domain, then 'console' > window.location = "https://office.myaddin.com", then reload in the add-in sidebar. It only temp fixes it though. :( – RichS Apr 22 '21 at 15:09
  • 1
    @RichS I didn't think to try that, I'll try that out and see if I can't convince some of our customers to give that a try in the meantime. I think I saw you commented on the issue I opened on the Officejs repo, hopefully the activity keeps pushing the issue back on on their radar – WTFranklin Apr 22 '21 at 19:25
  • @frankA, have you managed to resolve your issue yet? I've raised an issue on GitHub OfficeJS issues, but not got a resolution yet. One of my customers is, somehow, working again now. Still no idea what caused it fail and then work - and I'm completely unable to repro myself. – RichS Apr 28 '21 at 06:00
  • @RichS Not yet, I'm noticing the same sort of phenomenon right now too. I had one client actually send me her computer and sometime between doing a screen share call with her and seeing the problem happen first hand and getting it in the mail it started working. I tried updating Windows and Office for her so she was on the same version of Office as my computer and still worked fine for her but still isn't working for me. I had another client just starting having the issue the other day, but then it seemed to fix itself, so I have to ask her about that today – WTFranklin Apr 28 '21 at 13:36

1 Answers1

0

Recently, I also faced the same issue where I was getting OSF.DDA.ERROR and "Tracking Prevention blocked access to storage for" error.

I was able to resolve it after adding a setTimeout(function(){},1000) to my code and write my Office specific code inside it.

Adding setTimeout() helped me solve this issue. I also tried Office.onReady, but that didn't work for me.

It is trying to access Office specific functions before it fully loads.

Ajeet Shah
  • 18,551
  • 8
  • 57
  • 87