Ian*_*ter 3 javascript angularjs service-worker
这个答案在angular.js应用程序中注册服务工作者有一些有用的观点,但我仍然遇到问题.
奇怪的是,我知道服务工作人员在我的设置上工作,因为我已经通过了wittr演示https://github.com/jakearchibald/wittr并且已经接触过服务工作者.
现在我正在尝试在我的angularJS应用程序https://github.com/ianemcallister/Public_Transportation_App中设置服务工作者.我在我的金丝雀devtools控制台中收到以下错误:
GET http://localhost:9000/sw.js net::ERR_INSECURE_RESPONSE
ServiceWorker registration failed: DOMException: Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/html')
Run Code Online (Sandbox Code Playgroud)
我几乎从示例文件中复制和粘贴.它是否与构建过程有关,或者是关于如何在本地提供文件(两者都在本地主机上运行)?
我用https://github.com/angular-fullstack/generator-angular-fullstack构建了我的角度应用程序,示例应用程序与angular无关,这是我唯一能想到的.
如果有人能指出我正确的方向,我会非常感激!