Service worker with file:// origin doesn't work

时间:2017-06-15 10:16:18

标签: javascript polymer service-worker phonegap

i built phonegap app using polymer but while application is started and i debugged it in chrome i seen following error in console.

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?

1 个答案:

答案 0 :(得分:0)

出于安全考虑,我认为你不能。

相反,您需要运行本地Web服务器。 Chrome只提供一个https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb 我是节点连接https://www.npmjs.com/package/connect

的粉丝