How To Open Website On Startup with a Raspberry Pi

by Danny
7 comments

READING TIME: 5 MINUTES

Want to automatically launch a full-screen Chrome browser on your Raspberry Pi after it reboots?

If so, then this guide is for you.

Keep in mind, there are a number of different ways to do this. We still want the ability to use the Raspberry PI OS desktop like normal so this is the route we’ve chosen to go with. It’s far the easiest method we could find and is one of the cheapest ways to create a dashboard in your house without needing to hook up an extra computer.

Raspberry Pi Auto Open Website Use Cases

There are a number of reasons you might want to automatically launch a website on startup. This works for both internal URL’s and actual websites.

Here’s some examples:

For purposes of this guide, we are using our Raspberry Pi to display our Microsoft Teams Chats via URL.


Prerequisites

You will need a Raspberry Pi device loaded with the latest version of Raspberry Pi OS 32-bit with Desktop and recommended software. If you haven’t installed Raspberry Pi OS yet, you can follow our Raspberry Pi OS Installation guide using Balena Etcher.

You also need to connect your raspberry pi to your network/internet.


Equipment List

If you want to purchase the parts separately, here is what we recommend:

Raspberry Pi 3 Model B+ Board (3B+)
CanaKit 5V 2.5A Raspberry Pi 3 B+ Power Supply/Adapter (UL Listed)

If you want to purchase everything as a kit, here’s what we recommend:

Vilros Raspberry Pi 4 4GB Basic Kit with Fan Cooled Case
  • KEEP YOUR PROCESSOR COOL: The busier a processor gets, the more it heats up, leading to suboptimal performance. To prevent this common issue, we’ve included a pre-installed ready-to-connect fan in the case. Also included are a set of 4 heat sinks that can help to passively expel heat from your setup. These cooling mechanisms will help push the limits of your processor and increase its flexibility.
  • SIZABLE RAM: This Raspberry Pi 4 comes equipped with 4GB of RAM, which is the same amount of RAM or more RAM then many mainstream laptops contain. With 4GB of RAM, your processor will be capable of running retro gaming setups and common computer applications, media players and much more!
  • SIMPLE TO TURN ON & OFF: This kit includes a USB-C Raspberry Pi 4 compatible power supply with an easy-to-use on/off switch that was designed specifically for the Raspberry Pi 4 model to streamline processing.


Step by Guide To Automatically Launch URL On Startup with Raspberry PI Os

Before following this guide, we recommend opening this URL from the Chromium web browser on the Raspberry Pi.

Doing that will allow you to copy/paste the code below instead of manually typing it out.

Update your Raspberry PI

1. To update your Rasberry Pi OS, open a terminal and type. Hit enter after the first line.

sudo apt update
sudo apt full-upgrade

2. Next, you’ll need to configure the Chromium browser to open websites in full screen. Open a terminal and type this to get to the configuration setting:

cd .config

3. That should open the hidden configuration directory in your Pi user directory. Next, create the lxsession and lxde-pi directories. If you receive an error, then this folder already exists but if you’re setting up a brand new Pi – it won’t be there yet.

sudo mkdir -p lxsession/LXDE-pi

4. This next line opens a folder called autostart.

sudo nano lxsession/LXDE-pi/autostart

5. Paste the code below into the nano text editor. On the very last line, change the URL to the website you want to automatically open on startup or after a reboot.

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
#@xscreensaver -no-splash
point-rpi
@chromium-browser --start-fullscreen --start-maximized https://teams.microsoft.com/

5. Press CTRL+X to exit the nano text editor. Then press Y, then Enter to accept and save the “autostart” file.

Set default URL in Chromium Settings

During our test, we were able to get Chromium to launch in full screen with the website we specified. If you plan on changing the URL frequently, another route is to NOT specify a URL in the configuration but instead manage it through the Chrome browser.

To do this, you can change the default Chromium URL to https://teams.microsoft.com.

  1. Open Chromium. (If already maximized, click the X first.)
  2. Click the 3 dots on the far right to Customize and control Chromium.
  3. Settings > On Startup > Open a specific set of pages.
  4. Site Url: https://teams.microsoft.com

Test Automatically Opening Website On Raspberry Pi On Startup

After you’ve created the autostart file and set the default webpage, it’s time to test it out by rebooting your device.

To reboot your Raspberry Pi, click the raspberry icon in the top left corner > Shutdown > Restart.

If all goes well – the URL you specified should launch automatically in a full screen Chromium browser window! You can now display any website in the world as a dashboard for your smarthome, office, or garage.

Final Step

Now that you are able to get your Raspberry Pi to automatically launch a webpage after it reboots, the last step is to disable screenblanking or turn off the sleep settings.

Other Helpful Articles


My Homelab Equipment

Here is some of the gear I use in my Homelab. I highly recommend each of them.

The full list of server components I use can be found on my Equipment List page.

7 comments

You may also like

7 comments

Pobzeb October 14, 2020 - 9:32 pm

Just a comment about your URL not working in the autostart file. You need to make sure that the chromium command and the URL are all on the same line (no newline after the –start-maximized argument. Thanks for a great tutorial!

Reply
Danny October 14, 2020 - 10:18 pm

Thanks for the tip! I updated my doc and confirmed that your solution works perfectly.

Reply
Teresa May 20, 2021 - 1:46 pm

Regarding step 5, what if you don’t care if the screen is maximized? I just want the Pi to go to a youtube channel and play the music there.

Reply
Danny May 21, 2021 - 7:24 pm

You can just delete these so it doesn’t open in full screen or maximized: –start-fullscreen –start-maximized

Reply
Killproc July 22, 2021 - 6:39 pm

Install Unclutter and edit the LXDE autostart script:
sudo apt-get install unclutter
nano ~/.config/lxsession/LXDE-pi/autostart

Turn the cursor Off by adding the following line:
@unclutter -idle 2

Reply
Dan B October 19, 2021 - 10:31 pm

Would really like to know how I can automate logging into a web page. We have a Cisco Dashboard we’d like to monitor and they use angular.js login, where the login and the password are on 2 different pages.. (Enter username only, then enter, then on new page enter your password only, then enter)
This has been stumping me as I can’t use the typical plain txt in the URL, it fails to log in. http://login:password@www.yourURL.com.
Making the login/password visible to users/public is a non-issue as it’s a generic user account with no permissions..

Any help to stitch this together would be amazing! Thank you in advance!!

Reply
Danny October 19, 2021 - 10:42 pm

You may be able to use Powershell and Selenium to fill out the username and password.

Reply

Leave a Comment