Langley
Posts: 2
Joined: Mon Oct 05, 2015 1:20 pm

How to set up Kiosk web browser

Mon Oct 05, 2015 2:28 pm

Hello,

I have a Raspberry Pi 2 that I need to set up to display a web page automatically on start up. Every since upgrading to the Jessie release of Raspbian this has seemed impossible. I can install a browser (Even managed to install Chromium) and set up a script to start it in kiosk mode just fine, but no matter what method I try to use, I cannot get it to start automatically on boot.

My latest attempt has been following this guide https://www.danpurdy.co.uk/web-developm ... -tutorial/ but no matter what I put into /etc/xdg/lxsession/LXDE/autostart nothing happens on start up.
I have also tried methods involving local.rc but nothing happened there either.
I even tried installing Ubuntu MATE out of frustration but it just throws an error after installation.

If anyone could please tell me how to get Kiosk mode working somehow I would very much appreciate it.

DroneDeveloper
Posts: 2
Joined: Tue Oct 06, 2015 12:05 am

Re: How to set up Kiosk web browser

Tue Oct 06, 2015 4:09 am

What seems the biggest problem, is that you are not using the correct .config folder. Its actually located under your /home/pi/ folder. should be when you open a console, you should start in /home/pi/ from the console. so from there just type

Code: Select all

cd .config
cd autostart
I have actually ran into a very similar issue recently trying to run a different program on startup.
question of the day, are you also using the /home/pi/.config/autostart folder as well?

This is what I did that has mine working now.

SUGGESTION: I personally recommend using Firefox, which on the Raspberry Pi is called ICEWEASEL because its a solid fully developed browser, where chromium isnt very commandline friendly at all.

Code: Select all

sudo apt-get install iceweasel
then the simple code to load a specific website from command line works like this as an example:

Code: Select all

iceweasel www.walmart.com
From here you log into the desktop, click on the start menu, go down to INTERNET, then RIGHT-CLICK on Iceweasel, and click the create icon on desktop.

from here go back to command line and type

Code: Select all

sudo cp /home/pi/Desktop/iceweasel.desktop /home/pi/.config/autostart/iceweasel.desktop
cd /home/pi/.config/autostart/
sudo leafpad iceweasel.desktop
Just modifiy the Icon here by going SCROLLING all the way down to the bottom where it says,
Exec=iceweasel %u
and changing it to
Exec=iceweasel http://www.walmart.com
Or whatever your link of the day might be.
NOTE: :!: :!: :!:

NORMALLY 80% of programs run fine from the autostart folder. so once you got this icon configured with your website of choice, save it and reboot and test it. you might be done now.
;)

If it still wont load, continue on

I originally just dropped the desktop Icon for my program that wouldnt run under the above "autostart" folder and it didnt run when I rebooted, So I got a little creative, I opened up the icon using:

Code: Select all

sudo leafpad /home/pi/.config/autostart/Iceweasel.desktop
.

From here I copied the data that executes on the command line to run the program out, and decided to write some basic python3 code. in order to stall the loading process for the browser. I will show you below what i did. BTW, its ok to clean up the browser ICON by deleting all the foreign languages out of the icon.
  • [Desktop Entry]
    Encoding=UTF-8
    Name=Iceweasel
    Comment=Browse the World Wide Web
    GenericName=Web Browser
    X-GNOME-FullName=Iceweasel Web Browser
    Exec=python3 /home/pi/.config/MPKPyTimer/pytimer4.py
    Terminal=false
    X-MultipleArgs=false
    Type=Application
    Icon=iceweasel
    Categories=Network;WebBrowser;
    MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;
    StartupWMClass=Iceweasel
    StartupNotify=true
Then saved the above desktop Icon with the python3 code line in it instead. Then i went and

Code: Select all

cd /home/pi/.config
mkdir MKPyTimer
cd MKPyTimer
touch pytimer4.py
Which just generates a blank file named as above. open that blank file and insert this text.

Code: Select all

sudo leafpad pytimer4.py
  • # The Purpose of this document is to stall the ~/.config/autostart/
    # folder items load time. On normal startup, Desktop loads on LXDE
    # then the panel app(aka the start bar) loads a second or two after
    # the desktop. HOWEVER the autostart folder mentioned above actually
    # begins loading software that goes in the task bar before the
    # taskbar is even created. So I made this python script to stall
    # peticular taskbar dependant items from loading so quickly so that
    # the task bar would be present before they autostart up.
    # THE FOLLOWING SCRIPT IS WRITTEN IN PYTHON 3 -
    # This one Specifically is tied to X11VNC loading.

    import os
    from time import *

    sleep(10)
    os.system('iceweasel http://www.walmart.com')
Notice in the Parenthesis, on the os.system line, this is where the info from the ICON.Desktop file EXEC= goes. paste the executable line here. So basically what happens is that the Python 3 command runs this above python scipt which causes the icon to take a few more seconds before loading. Then it loads successfully.

So basically, in the pytimer4.py file, the IMPORT commands are required, and the sleep command just causes the system to pause this operation for some number of seconds in the Parenthesis. In this case, 10 seconds. The pause is necessary to allow the desktop to load up fully before running your program.

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: How to set up Kiosk web browser

Tue Oct 06, 2015 7:23 pm

Chromium had many command line options, including one to open a Web page which I think (from memory) no option is needed, simply a url after the chromium-browser command.

The full list is here:
http://peter.sh/experiments/chromium-co ... -switches/
There are 10 types of people: those who understand binary and those who don't.

Langley
Posts: 2
Joined: Mon Oct 05, 2015 1:20 pm

Re: How to set up Kiosk web browser

Fri Oct 09, 2015 10:40 am

Thank you for your replies.

I am open to trying out Iceweasel, but how do I make it start in kiosk-mode? ie, making it fullscreen and so on

fruitoftheloom
Posts: 20485
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: How to set up Kiosk web browser

Fri Oct 09, 2015 11:01 am

Langley wrote:Thank you for your replies.

I am open to trying out Iceweasel, but how do I make it start in kiosk-mode? ie, making it fullscreen and so on
Also there is kweb browser which has a Kiosk Mode:

viewtopic.php?f=66&t=40860
Retired disgracefully.....

broo0ose
Posts: 317
Joined: Wed Dec 14, 2011 3:59 pm
Location: Wirral, UK

Re: How to set up Kiosk web browser

Tue Oct 13, 2015 9:13 pm

I use kweb for some display screens, I also use /etc/xdg/lxsession/LXDE/autostart to kick it off.

my autostart file looks like this

Code: Select all

@kweb3 -KFJHCUA+-zbhrqfpoklgtjeduwxy file:///home/pi/index.html
@unclutter
this runs kweb3 showing a local page with no controls visible.
unclutter is a program that hides the mouse pointer.

rob+pi
Posts: 15
Joined: Fri Jan 11, 2013 12:17 am

Re: How to set up Kiosk web browser

Sat Oct 17, 2015 9:18 am

Its a hack but I also wanted iceweasel to go full screen on reboot.

I installed xdotool

Code: Select all

sudo apt-get install xdotool
then in my autostart file added a script file that has the following in it.

Code: Select all

#!/bin/sh
sleep 15
iceweasel http://MYURL &
sleep 15
xdotool key --clearmodifiers F11
Need the sleeps for Systemd, though they can probably be shorter, make sure you have the '&' on the end of the iceweasel command so it does not stop the script.

The xdotool sends the F11 key which is fullscreen.

Works for my needs, YMMV

abhinnkp
Posts: 1
Joined: Mon Jul 20, 2015 9:13 am

Re: How to set up Kiosk web browser

Thu Dec 31, 2015 9:54 am

Thanks Everyone It worked like a charm for me.
However for full screen, I used a bug of iceweasel. You can find it here.

https://bugzilla.mozilla.org/show_bug.cgi?id=1049807

Thanks Again!!!

roryschmitz
Posts: 1
Joined: Tue May 10, 2016 5:01 pm

Re: How to set up Kiosk web browser

Tue May 10, 2016 5:08 pm

So what exactly is the name of the file we add this to and where do you save it? I get an error message when trying to launch the file manually regarding 'sleep 15' Doesn't seem to like it.

Code: Select all

#!/bin/sh
sleep 15
iceweasel http://MYURL &
sleep 15
xdotool key --clearmodifiers F11


As an alternative, trying to get the following working:

Code: Select all

# The Purpose of this document is to stall the ~/.config/autostart/
# folder items load time. On normal startup, Desktop loads on LXDE
# then the panel app(aka the start bar) loads a second or two after
# the desktop. HOWEVER the autostart folder mentioned above actually
# begins loading software that goes in the task bar before the
# taskbar is even created. So I made this python script to stall
# peticular taskbar dependant items from loading so quickly so that
# the task bar would be present before they autostart up.
# THE FOLLOWING SCRIPT IS WRITTEN IN PYTHON 3 -
# This one Specifically is tied to X11VNC loading.

import os
from time import *

sleep(10)
os.system('iceweasel http://www.walmart.com')
This seems to work fine, but how to I incorporate the F11 fullscreen in the above script using the xdotools line here:

Code: Select all

xdotool key --clearmodifiers F11

dbatton
Posts: 1
Joined: Sun Aug 28, 2016 1:29 am

Re: How to set up Kiosk web browser

Sun Aug 28, 2016 1:51 am

Please view my blog... I provide setup instructions for using Chromium in kiosk mode on a Raspberry Pi 2 or 3...
http://dougbatton.blogspot.com/2016/08/ ... um-as.html

bdimov
Posts: 1
Joined: Wed Jan 25, 2017 11:27 am

Re: How to set up Kiosk web browser

Wed Jan 25, 2017 11:28 am

Hi,

it's working for me, but not at 100%.
I wrote all of the described above commands, but if I plug in an hdmi cable to my raspberry pi 2 and plug it into my monitor - it's starting regular and nothing happened.
I reallised that if I connect remotely via VNC then it's working - loads the page without infobars and etc.

How can I fix this, because I will use this one with hdmi cable plugged into monitor for showing presentation?

Kind Regards
Boyan Dimov

Return to “Networking and servers”