问题
We are developing an office-js javascript addin for Excel. We are testing the addin with sideloading in Excel on Windows. After updating Windows and Excel to new versions, the webview in Office/Excel has changed from IE to Edge. Now we need to delete the Edge browser cache in order to see the changes in the updated web service.
To completely reload a sideloaded office-addin, it was sufficient to delete the local storage and IE browser cache. After updating to the Edge webview, we do not manage to clear the browser cache.
In IE, we could flush the local storage and browser cache this way: del /q /s /f C:\Users\username\AppData\Local\Microsoft\Windows\Caches del /q /s /f C:\Users\ username\AppData\Local\Microsoft\Windows\INetCache del /q /s /f C:\Users\ username\AppData\Local\Microsoft\Office\16.0\WEF
psexec.exe -l c:\windows\system32\RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4359
Instead of psexec (sysinternals) we could as well delete the IE cache via the internet options dialog.
In order to delete the Edge cache, we tried del /q /s /f C:\Users\username\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC or by opening the Edge browser end delete the cache via the UI.
Unfortunately the Edge cache seems to be not completely deleted, the office addin does not completely show the changed contents from the web service.
回答1:
First - manually deleting is not a good practice - as @Rick Kirkham said use standard web techniques for proper caching. If you want to do it the hard way - list the cached files for the Edge WebViewHost like this:
dir /s %LOCALAPPDATA%\Packages\Microsoft.Win32WebViewHost_cw5n1h2txyewy\AC\#!123\INetCache\
This system directory is not visible. To empty the contents I used:
del /s /f /q %LOCALAPPDATA%\Packages\Microsoft.Win32WebViewHost_cw5n1h2txyewy\AC\#!123\INetCache\
In our case we are using Azure App Service (IIS) as server for our backend. And we added the following web.config setting to let the client re-validate all cached files:
...
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="0.00:00:00" cacheControlCustom="must-revalidate" />
</staticContent>
...
回答2:
When developing, its a good idea to turn off client side caching. The details will depend on what kind of server you are using. In most cases, it involves adding certain headers to the HTTP Responses. I've used the following pattern in the past, but you should research each of these and understand their effects.
Cache-Control: "private, no-cache, no-store"
Pragma: "no-cache"
Expires: "-1"
Also, see this SO question: What is the proper way to tell the browser not to cache.
回答3:
Try to refer the following steps to delete the Microsoft Edge browser data:
- In Microsoft Edge, go to More...> Settings.
- Click the Privacy & Security, select Choose what to clear.
- Select the check box next to each data type you’d like to clear, and then select Clear.
- If you’d like, turn the Always clear this when I close the browser setting to On.
The screenshot as below:
Besides, when you are using F12 developer tools to debug the website, you could also use the Developer Storage Tools to check the stored data and delete them. More detail information, please check this article.
回答4:
If use npm run build
and then npm start
then in word, add-ins taskpane setting button click Reload
.
来源:https://stackoverflow.com/questions/57909922/office-js-addin-with-excel-and-edge-webview-how-to-delete-cache