跟踪预防阻止访问 https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js 的存储 [英] Tracking Prevention blocked access to storage for https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js

查看:44
本文介绍了跟踪预防阻止访问 https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js 的存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大约一年半前,我使用 OfficeJS API 编写了一个 Excel 加载项,直到大约两周前它一直在工作.似乎 Excel 有一个更新,我现在可以右键单击任务窗格并查看开发工具,而我以前无法这样做,因此必须运行外部 MS Edge devtools 应用程序进行调试.这似乎是一个相对较新的问题,我似乎找不到任何有关它的信息.我尝试将 MS Edge 的跟踪预防设置减少到基本设置,如下所示:

我向 appsforoffice.microsoft.com 授予了 javascript 权限,因为 devtools 说它专门阻止此文件

但是,当对话框窗口打开时,数据不在 sessionStorage 中,因此无法读取,并且仍然出现错误跟踪保护阻止访问

previewString 在此对话框的 sessionStorage 选项卡中不可用

第二次我搜索了控制台给出的错误代码 OSF.DDA.ERROR 代码 7000,权限被拒绝 并在 SO Office JS Api - 权限被拒绝问题.这在过去似乎是一个错误,但我不确定是否再次出现这种情况.

解决方案

最近,我也遇到了同样的问题,我收到了 OSF.DDA.ERROR 和Tracking Prevention 阻止了对存储的访问"为"错误.

在我的代码中添加 setTimeout(function(){},1000) 并在其中编写我的 Office 特定代码后,我能够解决它.

添加 setTimeout() 帮助我解决了这个问题.我也尝试过 Office.onReady,但这对我不起作用.

它正在尝试在完全加载之前访问 Office 特定功能.

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.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://docs.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:

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.

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.

解决方案

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.

这篇关于跟踪预防阻止访问 https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js 的存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆