admin管理员组

文章数量:1319004

So I was exploring PWAs today and followed Your First Progressive Web App. It takes 5 mins and works on my laptop but the problem is, I can't figure out how to browse it through my phone yet. So I searched and found How can I access my localhost from my Android device? But unfortunately, the answers provided there don't work for me.

Why would that be? Does PWA require some different kind of setup? Am I going all wrong about this? Adiitionally I couldn't find any tutorials that take you to actually browsing your PWA in a mobile. Why?

So I was exploring PWAs today and followed Your First Progressive Web App. It takes 5 mins and works on my laptop but the problem is, I can't figure out how to browse it through my phone yet. So I searched and found How can I access my localhost from my Android device? But unfortunately, the answers provided there don't work for me.

Why would that be? Does PWA require some different kind of setup? Am I going all wrong about this? Adiitionally I couldn't find any tutorials that take you to actually browsing your PWA in a mobile. Why?

Share Improve this question asked Mar 17, 2018 at 11:02 AditiAditi 1,1982 gold badges18 silver badges45 bronze badges 3
  • Really? what's wrong with this question? No-one can answer it and yet someone has no problem down voting it! – Aditi Commented Mar 19, 2018 at 9:35
  • Happens :) I wish people add ment when they down vote. Got your answer and up-vote anyways! – Anand Commented Mar 19, 2018 at 15:42
  • said that there is nothing wrong with your question and now you have an answer which might possibly solve your issue, don't you see there is something wrong in not responding over a week for someone who cared to answer! – Anand Commented Mar 22, 2018 at 15:16
Add a ment  | 

3 Answers 3

Reset to default 7

While the Your First Progressive Web App tutorial tells you to start a server in your localhost. So as mentioned by @Anand, you won't be able to simply access the PWA in your phone.

The most simple solution is to use ngrok. Using it will expose a public URL for your web app which you can access in any device you want.

Simply install ngrok from here and follow through. Cheers ;)

I had a similar problem . I installed ngrok and accessed the URL it provided from the device. It worked pletely fine. Later I went through the link

https://developers.google./web/tools/chrome-devtools/remote-debugging/

In the settings, I enabled "discover USB devices and set up Port forwarding. Then, I was able to browse and debug the PWA ( which was running on my laptop), in the actual device. I understand if you have device next to your development machine, you can use remote devices USB debugging. If you want to show some demo from a remote place, you can use ngrok. Hope this helps!!!

Accessing PWA in any device browser is same as accessing any other web site. You simply access with the URL.

Problem in your case seem to be because you are accessing it as "localhost" in your mobile device. If you are running your web app in your desktop and if your mobile is also connected to the same network, access it using its IP address. Say

https://192.168.1.1/myapp/ instead of https://localhost/myapp/. When you put localhost in any device, what it refers to is local device (your android phone in your case), which is not actually running the web app and its your laptop, which is not local, but remote for your android phone.

You can also pack your android app as a apk and side load it. Try this site.

本文标签: javascriptBrowse PWA in mobileStack Overflow