[英]Service worker with file:// origin doesn't work
i built phonegap app using polymer but while application is started and i debugged it in chrome i seen following error in console. 我使用聚合物构建了phonegap应用程序,但是应用程序启动时我在chrome中调试它,我在控制台中看到以下错误。
Uncaught (in promise) DOMException: Failed to register a ServiceWorker: The URL protocol of the current origin ('file://') is not supported.
Anyone know how to use service worker with file:// origin? 任何人都知道如何使用file:// origin来使用服务工作者?
I don't think you can because of security considerations. 出于安全考虑,我认为你不能。
Instead you need to run a local web server. 相反,您需要运行本地Web服务器。 Chrome offers one https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb I am a fan of node connect https://www.npmjs.com/package/connect
Chrome提供了一个https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb我是节点连接的粉丝https://www.npmjs.com/package/connect
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.