最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Tracking Prevention blocked access to storage for https:appsforoffice.microsoft.comlib1.1hostedoffice.js - Stack Ov

programmeradmin2浏览0评论

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:

I gave javascript permission to appsforoffice.microsoft since devtools is saying it's blocking this this file specifically .1/hosted/office.js in the console. I also included just microsoft as well as the pany's URL and cdn url. I also added localhost since this is happening locally on my puter 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 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 pleted 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:

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 .1/hosted/office.js as well as a Permission Denied error.

previewString is not available in the sessionStorage tab for this dialog

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.

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:

I gave javascript permission to appsforoffice.microsoft. since devtools is saying it's blocking this this file specifically https://appsforoffice.microsoft./lib/1.1/hosted/office.js in the console. I also included just microsoft. as well as the pany's URL and cdn url. I also added localhost since this is happening locally on my puter 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./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 pleted 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:

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./lib/1.1/hosted/office.js as well as a Permission Denied error.

previewString is not available in the sessionStorage tab for this dialog

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.

Share Improve this question edited Apr 7, 2021 at 13:27 WTFranklin asked Apr 5, 2021 at 18:40 WTFranklinWTFranklin 2,5985 gold badges25 silver badges30 bronze badges 10
  • 2 This looks like a bug. Please raise an issue on the Office JS repo. – Rick Kirkham Commented Apr 8, 2021 at 17:34
  • 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 Commented Apr 22, 2021 at 11:09
  • 1 @RichS I'm still having the issue but now it seems local to my puter only. One of my clients who was having the issue sent me her puter and by the time it got here something had updated and her puter works perfectly now. I tried updating my version of Excel and still have the issue on Version 2103 (Build 13907.20400) and got her puter on the same version, but her puter 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 Commented Apr 22, 2021 at 13:32
  • 1 Yes, it works correctly for online Word. It seems like a certain bination 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 = "office.myaddin.", then reload in the add-in sidebar. It only temp fixes it though. :( – RichS Commented Apr 22, 2021 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 mented on the issue I opened on the Officejs repo, hopefully the activity keeps pushing the issue back on on their radar – WTFranklin Commented Apr 22, 2021 at 19:25
 |  Show 5 more ments

2 Answers 2

Reset to default 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.

The error message indicates that tracking prevention blocked access to storage for a URL that belongs to a tracker.

Possible solution: To fix this error, you can either change the tracking prevention level to Basic, which allows most trackers and those that personalize content and ads or add the URL to the list of exceptions, which allows storage access for specific sites. Alternatively, you can ignore the error if it does not affect the page's functionality.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论