我建立phonegap应用程序使用聚合物,但应用程序启动时,我调试它在铬我看到控制台中的以下错误。服务工作者与文件:/ /起源不起作用
Uncaught (in promise) DOMException: Failed to register a ServiceWorker: The URL protocol of the current origin ('file://') is not supported.
任何人都知道如何使用服务工作者的file://来历?
我建立phonegap应用程序使用聚合物,但应用程序启动时,我调试它在铬我看到控制台中的以下错误。服务工作者与文件:/ /起源不起作用
Uncaught (in promise) DOMException: Failed to register a ServiceWorker: The URL protocol of the current origin ('file://') is not supported.
任何人都知道如何使用服务工作者的file://来历?
我不认为你可以因为安全考虑。
相反,您需要运行本地Web服务器。 Chrome提供了一个https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb 我是节点连接的粉丝https://www.npmjs.com/package/connect
谢谢你的回复!通过进一步阅读,我发现服务人员只能使用HTTP或本地主机。 –
我从这里得到了答案! https://stackoverflow.com/questions/39136625/service-worker-registration-failed –