How To Open Website On Startup with a Raspberry Pi

How To Open Website On Startup with a Raspberry Pi

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:

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


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

Image 1 from How To Open Website On Startup with a Raspberry Pi