-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
service worker not working for localhost #915
Comments
You have to serve your service worker script with a mimetype of text/javascript or similar. Things like python -mSimpleHTTPServer should do this automatically for files ending in .js. |
@wanderview the file at root directory, its mime type is text/plain, and the file in app/ is also of same mime type text/plain. |
What's the scope for your service worker? You can not register a sw in |
(Well, actually you can but you need to set |
@delapuente |
The error message says sw.js is served with the MIME type text/html. It must be served with text/javascript or similar. It looks like your server is changing the MIME type based on the path. (Also this GitHub repository is not a good place for this issue, since it's not a spec issue.) |
Closing the issue, the problem was my route was not correctly configured in django app. ** Thanks for the help ** |
When i used http://localhost , and put sw.js file in root directory it works fine. But if i put sw.js file in http://localhost/app_name/ then it says net::ERR_INSECURE_RESPONSE in console and undefined:1 Uncaught (in promise) DOMException: Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/html').
The text was updated successfully, but these errors were encountered: