Open webpage automatically.

Posted by pablosink 
Open webpage automatically.
January 05, 2019 07:18PM
Hey everybody,

I have piratebox up and running on my RPI3. I'm playing around with and am wondering if the following is achievable?

When user connects to pibox network a webpage will automatically be opened on their device, so basically like a captive portal but actually skipping the captive portal stage, if that makes sense?

I'd like to use it for an art installation, where a video file will play automatically once a device connects.

I've looked through the forums and can't find a definite answer.

Also, I 'found' Brannon Dorsey's 'EmptyBox' fork, which is basically what I'm looking for, but it wasn't finished/completed/is not functional.

Any suggestions would be great.
Re: Open webpage automatically.
January 05, 2019 08:28PM
Just put a # in front on the following lines in /opt/piratebox/conf/lighttpd/lighttpd.conf

$HTTP["useragent"] =~ "CaptiveNetworkSupport" {
        server.document-root =  "/opt/piratebox/www/library/test/"
        index-file.names        = ( "success.html" )
        dir-listing.activate    = "disable"
        server.error-handler-404 = "/success.html"
}


include "/opt/piratebox/conf/lighttpd/fastcgi-php-generate203.conf"

The result is, that the device's captive portal browser will pop up.
But this browser is limited and might not be sufficient. That is all you can achieve. It is not possible to pop up a full safari on iOS anymore. Android is having issues as well, because it "things" the wifi is not working correctly.

Put your content into the content folder, make sure every piece of the HTML pages are available locally to prevent a 404 loop.

Somewhere, I have a art-based mod laying around which has a working captive portal as well, but mostly to tell people what to do with that hotspot. smiling smiley

best regards Matthias
Re: Open webpage automatically.
January 06, 2019 02:50PM
Hey Matthias,

Many thanks for your reply and help!

Ok, so I just tried that and it does bring up the captive portal page.

I've tried it twice

1. using the pirate box page which loads up fine within the captive portal page (I can press links send, messages etc)

2. With no piratebox 'stuff' and with just a video to automatically play. However, when this page appears in the captive portal, the video does not play and I can just see the play button etc.

Soooo, maybe this is not possible, but...I wonder....

1. Is there anyway to get the video to play?
2. Is it possible to customize/hack the captive portal page (change its size etc) and if so, could you point me in the right direction?

Thanks again for you help (and a brilliant project spinning smiley sticking its tongue out !)



Edited 1 time(s). Last edit at 01/06/2019 03:16PM by pablosink.
Re: Open webpage automatically.
January 11, 2019 08:00AM
> 1. Is there anyway to get the video to play?
I assume not, because the browser is limited.

>2. Is it possible to customize/hack the captive portal page (change its size etc) and if so, could you point me in the right direction?
The captive Portal page is nothing more then the default redirect to the main page.
So what do you mean with that question?

best regards
Matthias
Re: Open webpage automatically.
January 11, 2019 04:31PM
Hey Matthias,

Thanks again for your help and time.

1. That's a shame!

2. Ok, apologies, just really understanding captive portals a bit better now, so realising that (I think!) that for example, if I am accessing piratebox using a macbook, the size of the captive portal is 'decided' by the macbook.

3. New question: The top of the captive portal states 'Join Piratebox' whereas as at the bottom it has '[piratebox.lan]; ....where can I change this so that it will appear as something else,eg : '[example.lan&];.
If I was to rename /opt/piratebox to /opt/example would that do it, or would that impact sub directories etc?

Also (Just for anyone who might be trying something similar) .gifs work no problem!
Cheers!



Edited 1 time(s). Last edit at 01/11/2019 04:44PM by pablosink.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically.
  ******   ********        **  **     **   *******  
 **    **  **    **        **  **     **  **     ** 
 **            **          **  **     **  **        
 **           **           **  **     **  ********  
 **          **      **    **   **   **   **     ** 
 **    **    **      **    **    ** **    **     ** 
  ******     **       ******      ***      *******  
Message: