How to clear client side browser cache for Excel 2016 Task Pane add-in on Mac?

旧时模样 提交于 2020-01-23 18:17:06

问题


This is a follow-up to a previous question where the answer to "How do I ensure I see the latest JS code in my Task Pane add-in" involved controlling the client side caching behavior via server-added meta/no-cache tags (or versioning the server resources).

However, I am looking for a manual way, on the client, for the end-user to clear out the client side cache that appears to be storing JavaScript files and preventing an updated JS file on the server from being used by the Task Pane add-in. During development, I'll be updating the JS resources frequently on the server and I am looking for a client side solution that allows those updated files to be used.

Environment: Desktop version of Excel 2016 running on Mac (OSX 10.11.5) Task Pane add-in using v1.2 of the Excel/Office.js.

Scenario: deploy add-in artifacts to web server, run add-in on Mac. Then update code in foo.js in add-in, re-deploy to web server. Run add-in and see old (pre-update) behavior from foo.js.

What I have tried:

  1. On the same Mac, loaded foo.js directly from the web app in Safari. I can see the changes in the js code that I expect to be in the updated version.

  2. Cleared the Safari cache (Privacy > Remove All Website Data) (I suspected that this would not work based on #1 - Safari does not appear to share a cache with Excel but worth a shot) - did not change anything.

  3. Poked around under ~/Library/Containers/com.microsoft.Excel trying to find a cache - deleted ~/Library/Containers/com.microsoft.Excel/Data/Library/Caches/com.microsoft.Excel - no help.

  4. Used the Reload menu item from the Task Pane's context menu (looks like [i] on the Mac) - no difference: still seeing old foo.js.

Where are the JavaScript files referenced by an Excel (desktop) 2016 Task Pane add-in stored? (on the Mac) and how can the end user remove them?


回答1:


I stumbled upon com.Microsoft.OsfWebHost while poking around using the "defaults" command from a Terminal on the Mac. Some googling turned up this article which basically provided the answer. In a slight refinement to what is instructed there, this is what I did:

  1. ensured that I had quit Excel
  2. in Finder, navigated to ~/Library/Containers/com.Microsoft.OsfWebHost/Data/Library/Caches
  3. renamed (or deleted) the folder named "com.Microsoft.OsfWebHost" there
  4. opened my workbook in Excel (it already has the add-in Inserted)
  5. nothing seemed to be loading, so I used the Reload command from the context menu in the Task Pane

Now I could see that my updated version of the java script file has been loaded.

This is based on empirical evidence only, no corroboration from Microsoft or Apple doc, so your mileage may vary.

BTW, there are some interesting "defaults" properties for the com.Microsoft.OsfWebHost:

defaults read com.Microsoft.OsfWebHost
{
WebKitCacheModelPreferenceKey = 1;
WebKitDebugFullPageZoomPreferenceKey = 1;
WebKitPluginsEnabled = 0;
WebKitUsesPageCachePreferenceKey = 0;
}

Googling for WebKitCacheModelPreferenceKey did not turn up any official documentation, but there seem to be suggestions that setting it to 0 might suppress caching.



来源:https://stackoverflow.com/questions/38248350/how-to-clear-client-side-browser-cache-for-excel-2016-task-pane-add-in-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!