Web worker file is cached and never re-loaded in IE 11

两盒软妹~` 提交于 2019-12-04 11:46:32

The same problem exists in Chrome. In order to get around it you can use a cache buster:

Main Code:

var buster = randomNumberOrBuildNumber;
var worker = new Worker( "the/worker/URL/Code.js?buster=" + buster );

Worker:

importScripts( 'script/to/import.js' + self.location.search );

This will apply ?buster=12345 (or whatever your randomNumberOrBuildNumber is set to) to both the loading of the worker and any importScripts() calls the worker makes.

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