Skip to content
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

PWA offline mode not working #26

Closed
rof20004 opened this issue May 26, 2017 · 13 comments
Closed

PWA offline mode not working #26

rof20004 opened this issue May 26, 2017 · 13 comments
Labels

Comments

@rof20004
Copy link

I did a fresh install of a new project:

vue init pwa testingpwa
cd testingpwa
yarn

After that I generate the build for production:

npm run build

Then start that build using a local server:

cd dist
started my web server: http://localhost:8080

I access the app using Samsung Galaxy Tab 2 using the IP of my computer

http:10.10.10.10:8080

The web app opened and I added the application to Homescreen
After I go offline using airplane mode and try to open application using the icon on my homescreen.
The PWA not worked, It show offline. My browser is Google Chrome 58.0.3029.83

example_screenshot_error

@Naramsim
Copy link
Contributor

Are you browsing Google.com.br or your webapp?

@rof20004
Copy link
Author

rof20004 commented May 26, 2017

No, I get the screenshot in my pc because I do not know how to do this in mobile :D , I only wanna show the image tha appears. I am browsing my app, I used the google.com.br only to take screenshot.

@Naramsim
Copy link
Contributor

Yep, maybe I've understood the issue, you browsed and are browsing from 10.0.0.1, but currently, this PWA is implemented to be tested only using 127.0.0.1/8 subnet

So you have to browse 127.0.0.1, turn off the Internet and reload, everything should work fine.

@rof20004
Copy link
Author

But if I test with a mobile? I only can access using my IP address.

@rof20004
Copy link
Author

If I remove this line in condition it will work?
(window.location.protocol === 'https:' || isLocalhost)

I will test here

@rof20004
Copy link
Author

I tried and not worked, I need HTTPS?

@rof20004
Copy link
Author

Well, I tried with https, on port 443, and not worked, I think that have a problem caching files, and in my PC browser always have many errors that can not fetch manifest.json and service-worker.js

@addyosmani
Copy link
Collaborator

You generally need to either be directly running off of localhost (whitelisted) or a domain with HTTPS setup in order for the Service Worker to successfully register.

I'm unsure about the specifics of the setup above, but if you're trying to test on mobile I'd recommend plugging your phone up to your system over USB and using DevTools remote debugging which will let you test your local version with SW correctly: https://developers.google.com/web/tools/chrome-devtools/remote-debugging/

@rof20004
Copy link
Author

Well, I will waiting for #12 , because it apears to me and i will try again another day, but I think this is strange, I created a PWA that works offline, without vue, and it worked like I expected, doing the same tests here, I did it manually, maybe I miss something using with vue-cli. Thanks and regards everyone.

@eMerzh
Copy link

eMerzh commented Aug 3, 2017

@addyosmani
sorry to dig up this old issue, but kinda have the same issue, not abble to make offile work...
not sure i do smth wrong...
what i did :

  • init the vue pwa app with vue-cli
  • add codes
  • ran yarn dev
  • then in network panel of devtool set offline
  • reload
    and it fails

is there smth that i don't get ?

thanks

@JavaTheNutt
Copy link

@eMerzh Unless you modified your webpack config, offline shouldn't work in dev mode. You don't want assets to be cached while in development.

@hathemi
Copy link

hathemi commented Jan 20, 2019

is there a solution ???

@rof20004
Copy link
Author

@hathemi Hi, I opened this issue years ago, now the vue-cli works perfect without this problem. May you need to open a new ticket with details of your problem.

My problem was solved doing this:

  1. PWA only works with https.
  2. service-worker.js needs no cache.

Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants