16vmonkey
Posts: 4
Joined: Wed Jun 13, 2012 12:54 pm

Auto open browser on boot

Wed Jun 13, 2012 12:57 pm

Hi all,

I've been tasked a small project... A sales office wants to use a Pi as a information dashboard up on the wall which involves it just displaying a webpage hosted locally.

I need the Pi to automatically boot, open a browser full screen (F11 stylee) and point to a page.

I would be very grateful for any input!

Mike.

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Auto open browser on boot

Wed Jun 13, 2012 1:09 pm

To launch a command automatically on login, put the command into a file named
.bashrc
in the user directory (for example /home/pi)

For example, the file could contain
chromium-browser --kiosk www.google.com
to launch Chromium in full-screen pointed to www.google.com

16vmonkey
Posts: 4
Joined: Wed Jun 13, 2012 12:54 pm

Re: Auto open browser on boot

Wed Jun 13, 2012 1:47 pm

fantastic, worked a treat :)

Thank you!

16vmonkey
Posts: 4
Joined: Wed Jun 13, 2012 12:54 pm

Re: Auto open browser on boot

Wed Jun 13, 2012 1:55 pm

PM received thanks Bredman, it wont let me reply as I assume i'm a new user. Will keep you posted.

cyanarnofsky
Posts: 70
Joined: Tue Jul 31, 2012 11:33 pm

Re: Auto open browser on boot

Fri Nov 02, 2012 7:04 pm

exactly what I need as well!, possible to disable mouse courser from the system completely? I can use all keyboard commands and this would remove it from showing up onscreen when restarted. Thanks for any help!

User avatar
Super-Nathan
Posts: 67
Joined: Sun Jun 17, 2012 6:56 am
Location: South Korea

Re: Auto open browser on boot

Wed Nov 07, 2012 2:40 am

Frankly your best bet would be to install openbox and have openbox open the bowser for you. this would give you a fullscreen webbrowser with NOTHING else. no statusbar, no time, no startmenu, nothing but the browser.

Code: Select all

sudo aptitude install openbox obconf obmenu 
and then make a openbox config file with

Code: Select all

mkdir -p ~/.config/openbox && cp /etc/xdg/openbox/* ~/.config/openbox
Then edit the autostart to openthe browser at boot

Code: Select all

nano ~/.config/openbox/autostart
remove all the code and past this in:

Code: Select all

# Autostart script
#will sleep to make sure everything else loads
sleep 5s && midori  --inactivity-reset=120 -e Fullscreen --app=/PATH/TO/HOMEPAGE/FILE.html
that will make it run with fewer options auto resetting after 2 minutes inactivity
echo "Something Useful" > /dev/null

User avatar
Super-Nathan
Posts: 67
Joined: Sun Jun 17, 2012 6:56 am
Location: South Korea

Re: Auto open browser on boot

Wed Nov 07, 2012 2:42 am

bredman wrote:To launch a command automatically on login, put the command into a file named
.bashrc
in the user directory (for example /home/pi)

For example, the file could contain
chromium-browser --kiosk http://www.google.com
to launch Chromium in full-screen pointed to http://www.google.com

Chromium is MUCH to slow to browse comfortably on the pi,especially with lxde overhead which you do not need. you WILL see speed increases with openbox/midori!
echo "Something Useful" > /dev/null

coolblue2000
Posts: 30
Joined: Tue Jan 08, 2013 9:48 am

Re: Auto open browser on boot

Wed Jan 09, 2013 3:46 pm

To launch a command automatically on login, put the command into a file named
.bashrc
in the user directory (for example /home/pi)

For example, the file could contain
chromium-browser --kiosk www.google.com
to launch Chromium in full-screen pointed to www.google.com
I have done this but it does not recognise chromium-browser.... I changed it to simply chromium instead but I get the error (chromium:2100): Gtk-WARNING **: cannot open display:

If I set the pi to boot in to the GUI on startup then it gets to the GUI without opening chromium but if I try to open the terminal suddenly the pi starts chromium in kiosk mode.......

What am I doing wrong?

sdjf
Posts: 1397
Joined: Fri Mar 16, 2012 5:20 am
Location: California

Re: Auto open browser on boot

Mon Jan 14, 2013 4:45 am

Try putting the following line just before the one invoking your browser.

export DISPLAY=:1

The line you had which created an error is probably the right command. I am not sure whether 1 is the right display number, but I have the above line in my .bashrc on a host box I VNC into, so I can start GUI apps from command line when I want to.

Since it is coming back with :2100 in your error message, you might try display number :0

Also, I would be concerned about starting the app from your .bashrc and not ending the line with an ampersand so that .bashrc can finish any other things you might place there in addition, after calling the browser. Otherwise, .bashrc will not close until you close chromium.
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

coolblue2000
Posts: 30
Joined: Tue Jan 08, 2013 9:48 am

Re: Auto open browser on boot

Mon Jan 14, 2013 12:45 pm

I have tried export DISPLAY=:1 and export DISPLAY=:0

Both give me the error "Cannot open display:1" or "Cannot open display:0"

sdjf
Posts: 1397
Joined: Fri Mar 16, 2012 5:20 am
Location: California

Re: Auto open browser on boot

Mon Jan 14, 2013 4:45 pm

coolblue2000 wrote:I have tried export DISPLAY=:1 and export DISPLAY=:0

Both give me the error "Cannot open display:1" or "Cannot open display:0"
I hope somebody can solve that, I get the same thing when I try to open a VNC server on my Pi, so do not know the answer at this point.
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

coolblue2000
Posts: 30
Joined: Tue Jan 08, 2013 9:48 am

Re: Auto open browser on boot

Fri Jan 18, 2013 12:31 pm

Ok, I have got it working. It seems you can't start chromium from bash as it there is no gui so fails.

I got chromium to start on boot by adding "@chromium --kiosk www.bbc.co.uk" to the "autostart" file in /etc/xdg/lxsession/LXDE/


One problem though.....

On my home pi this works fine (not going through a proxy at home), however on the one at work chromium complains that it can not connect to the proxy server.

The proxy is setup on the pi and if I start Chromium from the desktop it works fine, also if I start chromium from terminal using "Chromium --kiosk www.bbc.co.uk" it also works fine.

Why is it complaining about the proxy server when it is started from the autostart file? And is there a way to specify the proxy in the "@chromium --kiosk www.bbc.co.uk" line?

Also if I autostart with the following line @chromium www.bbc.co.uk

ie not in kiosk mode so I have access to the menus, the same thing happens, but if I click refresh it works fine.... So it looks like a timing issue possibly?

If I use @chromium --proxy-auto-detect www.bbc.co.uk I no longer get the proxy server error, however I get a webpage not available error instead. If I refresh it works fine.....

Do I need to somehow pause the execution of chromium for a few seconds in order for the desktop to catch up? If so how do I do this in the autostart file?


stevenh
Posts: 4
Joined: Thu Jan 31, 2013 11:08 am

Re: Auto open browser on boot

Thu Jan 31, 2013 11:19 am

Super-Nathan wrote:Frankly your best bet would be to install openbox and have openbox open the bowser for you. this would give you a fullscreen webbrowser with NOTHING else. no statusbar, no time, no startmenu, nothing but the browser.

Code: Select all

sudo aptitude install openbox obconf obmenu 
and then make a openbox config file with

Code: Select all

mkdir -p ~/.config/openbox && cp /etc/xdg/openbox/* ~/.config/openbox
Then edit the autostart to openthe browser at boot

Code: Select all

nano ~/.config/openbox/autostart
remove all the code and past this in:

Code: Select all

# Autostart script
#will sleep to make sure everything else loads
sleep 5s && midori  --inactivity-reset=120 -e Fullscreen --app=/PATH/TO/HOMEPAGE/FILE.html
that will make it run with fewer options auto resetting after 2 minutes inactivity

I am working on a similar project.
I tried this, but it doesn't launch at startup.
and If I say "startx" after logging in, it starts the default GUI
can I skip login and just directly into the browser?
Tx.
Steve

adhall
Posts: 1
Joined: Fri Sep 06, 2013 8:34 pm

Chromium Full Screen on Boot

Fri Sep 06, 2013 8:42 pm

Hello, I am in charge of making the switch in how we do digital signage at our University, and was experiencing problems with Midori crashing. We are switching to "Chromium" to see if that will work better, but I was wondering if there was anyone that could advise me on the code to do this. I need Chromium to start on boot and open a specific webpage in Full Screen. I will list the code that seemed to be working on Midori until it crashed below. Thanks.

This is in a file that I created and made executable.

• #!/bin/bash
• midori –e Fullscreen –a http://display.northcentral.edu/screen/?mac=`ifconfig | grep HWaddr | tr –s “ “ | cut –d “ “ –f 5`

gingbeard
Posts: 8
Joined: Tue Apr 10, 2012 8:07 am

Re: Auto open browser on boot

Wed Sep 11, 2013 2:38 pm

Sorry to kick up an old thread...

We're using the instructions here - https://github.com/MobilityLab/TransitS ... spberry-Pi to set-up a "web screen" that loads a webpage on boot, and nothing else.

The page in question has a username/password access system. Is there a way to get Midori to auto-enter these details and enter?

pilkie
Posts: 10
Joined: Sat Feb 02, 2013 5:46 pm

Re: Auto open browser on boot

Thu Nov 05, 2015 7:28 am

Super-Nathan wrote:Frankly your best bet would be to install openbox and have openbox open the bowser for you. this would give you a fullscreen webbrowser with NOTHING else. no statusbar, no time, no startmenu, nothing but the browser.

Code: Select all

sudo aptitude install openbox obconf obmenu 
and then make a openbox config file with

Code: Select all

mkdir -p ~/.config/openbox && cp /etc/xdg/openbox/* ~/.config/openbox
Then edit the autostart to openthe browser at boot

Code: Select all

nano ~/.config/openbox/autostart
remove all the code and past this in:

Code: Select all

# Autostart script
#will sleep to make sure everything else loads
sleep 5s && midori  --inactivity-reset=120 -e Fullscreen --app=/PATH/TO/HOMEPAGE/FILE.html
that will make it run with fewer options auto resetting after 2 minutes inactivity
I've tried exactly this using the latest Raspbian from noobs, nothing happened. Do I need to set it to boot into command line because mine boots into the GUI automatically

pema
Posts: 14
Joined: Tue Feb 09, 2016 10:49 am

Re: Auto open browser on boot

Fri Feb 26, 2016 3:22 pm

Save your time, this method no longer works. I have yet not found any other.

fvlgnn
Posts: 2
Joined: Wed Jul 20, 2016 12:14 pm

Re: Auto open browser on boot

Wed Jul 20, 2016 12:17 pm

I solved using autostart of LXDE-pi and a sh file with epiphany browser.

I had to install xautomation for simulate an user input

Code: Select all

sudo aptitude install xautomation
In the home of pi I've created a sh file

Code: Select all

touch start_browser.sh
I've inserted the following code in the file

Code: Select all

# running the browser on the main desktop
sudo -u pi epiphany-browser -a --profile ~/.config http://www.google.com/ --display=:0 & 
# waits a few seconds, we wait that the browser has started successfully   
sleep 15s;
# xautomation simulates the pressure on the F11 key for activate the browser in full screen mode on the main desktop
xte "key F11" -x:0
I added the executable permission on the sh file with chmod command

Code: Select all

sudo chmod 755 start_browser.sh
I've modified the autostart files of LXDE-pi session

Code: Select all

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
by adding the following command to run my sh file

Code: Select all

@/home/pi/start_browser.sh
Now our browser should be start in full screen mode at each boot

If it does not, check that the Raspberry's configuration had enabled the boot into the desktop environment

Code: Select all

sudo raspi-config
Select: 3 Enable Boot to Desktop/Scratch

Select: Desktop Log in as user 'pi' at the graphical desktop

Enjoy

fvlgnn
Posts: 2
Joined: Wed Jul 20, 2016 12:14 pm

Re: Auto open browser on boot

Wed Jul 20, 2016 12:20 pm

I solved using autostart of LXDE-pi and a sh file and epiphany browser.

I had to install xautomation for simulate an user input

Code: Select all

sudo aptitude install xautomation
In the home of pi I've created a sh file

Code: Select all

touch start_browser.sh
I've inserted the following code in the file

Code: Select all

# running the browser on the main desktop
sudo -u pi epiphany-browser -a --profile ~/.config http://www.google.com/ --display=:0 & 
# waits a few seconds, we wait that the browser has started successfully   
sleep 15s;
# xautomation simulates the pressure on the F11 key for activate the browser in full screen mode on the main desktop
xte "key F11" -x:0
I added the executable permission on the sh file with chmod command

Code: Select all

sudo chmod 755 start_browser.sh
I've modified the autostart files of LXDE-pi session

Code: Select all

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
by adding the following command to run my sh file

Code: Select all

@/home/pi/start_browser.sh
Now our browser should be start in full screen mode at each boot

If it does not, check that the Raspberry's configuration had enabled the boot into the desktop environment

Code: Select all

sudo raspi-config
Select: 3 Enable Boot to Desktop/Scratch

Select: Desktop Log in as user 'pi' at the graphical desktop

Enjoy

dcobb
Posts: 6
Joined: Fri Nov 10, 2017 5:57 am

Re: Auto open browser on boot

Sat Nov 11, 2017 4:29 am

fvlgnn wrote:
Wed Jul 20, 2016 12:20 pm
I solved using autostart of LXDE-pi and a sh file and epiphany browser.

I had to install xautomation for simulate an user input

Code: Select all

sudo aptitude install xautomation
In the home of pi I've created a sh file

Code: Select all

touch start_browser.sh
I've inserted the following code in the file

Code: Select all

# running the browser on the main desktop
sudo -u pi epiphany-browser -a --profile ~/.config http://www.google.com/ --display=:0 & 
# waits a few seconds, we wait that the browser has started successfully   
sleep 15s;
# xautomation simulates the pressure on the F11 key for activate the browser in full screen mode on the main desktop
xte "key F11" -x:0
I added the executable permission on the sh file with chmod command

Code: Select all

sudo chmod 755 start_browser.sh
I've modified the autostart files of LXDE-pi session

Code: Select all

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
by adding the following command to run my sh file

Code: Select all

@/home/pi/start_browser.sh
Now our browser should be start in full screen mode at each boot

If it does not, check that the Raspberry's configuration had enabled the boot into the desktop environment

Code: Select all

sudo raspi-config
Select: 3 Enable Boot to Desktop/Scratch

Select: Desktop Log in as user 'pi' at the graphical desktop

Enjoy
I tried this and after the reboot nothing happened... I am a noob so maybe there is something I did wrong?

Thanks!

kfarr
Posts: 1
Joined: Sun Nov 26, 2017 8:51 am

Re: Auto open browser on boot

Sun Nov 26, 2017 8:54 am

Yes I had the same problem and the instructions on this stack overflow page helped fix it:
https://raspberrypi.stackexchange.com/q ... e086bdccc2

In short you need to use the pi user's autostart file in order to launch chromium, not the system wide one.

ricardoalcg
Posts: 5
Joined: Tue Nov 21, 2017 3:45 pm

Re: Auto open browser on boot

Mon Nov 27, 2017 5:25 pm

Hi I am having simillar problems.
I want to autostart the application Rdesktop when the system boots but without success.

When I try to execute /etc/xdg/lxsession/LXDE-pi/autostart it says Permission Denied


I have NOOBS version 2.1 with the pi user.


Any help will be great.
Thank you

klintkrossa
Posts: 84
Joined: Tue Nov 10, 2015 3:06 pm

Re: Auto open browser on boot

Fri Apr 06, 2018 6:10 am

What about an if command in the .bashrc script?
Thanks
This is not like any other bulletin boards that I have been on. Been flamed on other BB's so bad I was afraid to ask.

All my Raspberry Pi's are like the Hessian artilleryman of Sleepy Hollow.

gmandisk
Posts: 1
Joined: Thu Nov 15, 2018 1:13 am

Re: Auto open browser on boot

Thu Nov 15, 2018 1:15 am

how do i automatically open up multiple tabs?

Return to “Beginners”