I've configured a Raspberry Pi as a Wifi hotspot and web server. What I'm trying to do is get the user's phone to automatically open a web browser when they connect to it. There is no Internet connection.

I setup a redirect for /generate_204 so that the "Sign-in to Wifi" notification appears when someone connects. When they tap the notification, they are taken to a webpage in the CaptivePortalLogin. The functionality of the captive portal is limited as it doesn't seem to store session information, allow the user to download files, etc. Even if /generate_204 returns a 204 response, it seems the captive portal just closes and no web browser is launched.

Is there anyway to launch a browser instead of the captive portal when a user connects to a Wifi network? Or is there a way to launch a browser once the captive portal has been opened?

Thanks for any ideas about this.

  • AFAIK, Once you sign in via captive portal, it can be used normally. just open a browser and go. Anyway, What you are suggesting is a package of code takes over the device connected to the network and open an app. It's pretty much malware. Besides, I doubt it's possible without root. – Dan Brown Oct 25 '16 at 20:51
  • Yes, it can be done manually after connecting, but I was hoping to save the user the additional steps of launching the browser and typing "xyz.com" into the URL bar, which redirects them to the webpage. – brennanhm Oct 25 '16 at 21:05
  • 1
    Sorry, don't think you can automate it. – Dan Brown Oct 25 '16 at 21:07
  • 4
    I did find an alternative way to open the browser, but it's a bit of a hack. If you configure the web server with a self-signed certificate and redirect generate_204 to a page over HTTPS, then the captive portal will present a security warning with an option to "Continue anyway via browser". Tapping the link will open the default browser. Then the user has to accept the browser's security warning to continue. Not ideal, but an option. – brennanhm Oct 27 '16 at 23:12
  • If it works, it works. At least it's an idea. – Dan Brown Oct 27 '16 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.