googlesamples / io2015-codelabs

codelabs for Google I/O 2015
https://codelabs.developers.google.com/
Apache License 2.0
516 stars 165 forks source link

MINE type text/plain error #162

Open Brett-Henning opened 4 years ago

Brett-Henning commented 4 years ago

Unable to get the service worker to work in Codelab -> Adding a Service Worker and Offline into your Web App

if('serviceWorker' in navigator) { navigator.serviceWorker .register('/sw.js') .then(function() { console.log("Service Worker Registered"); }); } Returns MINE error wrong type text/plain

This is using the Python server instructions provided python -m SimpleHTTPServer 3000

michelvanveldhoven commented 3 years ago

I received the same error with pyton 3.8 localhost/:1 Uncaught (in promise) DOMException: Failed to register a ServiceWorker for scope ('http://localhost:3000/') with script ('http://localhost:3000/sw.js'): The script has an unsupported MIME type ('text/plain').