在Laravel注册服务工作人员



我正在使用PushPad(来自PushPad.XYZ),并遵循3个初始步骤,使用我的Laravel 5.5项目设置此SDK。但是,一旦我访问测试视图,它就找不到并注册了Servericateworker.js我尝试将其放在整个地方,现在几乎每个文件夹中。因此,我知道这是模糊的描述,但是如果您快速查看Pushpad的文档,您就会知道我的意思。而且,当我手动尝试打开它时,我会得到404。当我尝试通过https://link的位置将其导入404当我复制其内容并在脚本标签中使用它时,我也会得到404。我很难继续

A bad HTTP response code (404) was received when fetching the script.
Failed to load resource: net::ERR_INVALID_RESPONSE
push-test:1 Uncaught (in promise) TypeError: Failed to register a 
ServiceWorker: A bad HTTP response code (404) was received when fetching the 
script.

您需要确保您在网站的 root Directory 中都有 service-worker.js 文件。

您可以通过在浏览器中键入https://example.com/service-worker.js来验证安装。

最新更新