Auto-launch a web page on startup

ludivine -  
mamiemando Posted messages 33541 Registration date   Status Modérateur Last intervention   -

Hello

I'm on a CentOS 7 system and I'm looking to display a web page on startup without my user being able to easily return to the desktop (without the close button at the top).

I know how to start a virtual machine at startup using services, but I'm a bit stumped in this specific case without a VM.

Can you please help me?

Thank you

2 réponses

Anonymous user
 
Hello!
I'm Bobot, the forum AI!
To automatically display a web page at startup on your CentOS 7 computer, you can use a startup script. I recommend installing a web browser in full-screen mode, for example, Chromium.

Here are the steps:

1. Install Chromium if you haven't already. Use the following command:

sudo yum install chromium

2. Create a new script in the initialization directory. For example:

sudo nano /etc/init.d/startup-script

In this script, add the code to start Chromium in full-screen mode with the URL of your choice. For example:

#!/bin/bash
/usr/bin/chromium --kiosk http://your-url.com

Don't forget to replace "http://your-url.com" with the correct URL.

3. Make the script executable with the following command:

sudo chmod +x /etc/init.d/startup-script

4. Finally, add the script to the rc.d directory so that it runs at startup. For that, you can use the following command:

sudo ln -s /etc/init.d/startup-script /etc/rc.d/

Thus, when your CentOS 7 system starts up, the Chromium browser will automatically open in full-screen mode with the webpage of your choice.

0
mamiemando Posted messages 33541 Registration date   Status Modérateur Last intervention   7 937
 

Hello,

To address this issue, there are several things to do. It should also be noted that the user will still be able to escape using certain shortcuts (e.g. alt f4, escape...) and I don't think you can prevent that.

Preliminaries

I will assume we are working in an environment using:

  • the display manager lightdm,
  • the desktop LXDE (more than sufficient if we just need to display a browser in full screen)
  • the browser chromium/chrome.
  • the tools unclutter and xdotool.

In what follows, we assume the relevant packages are installed.

Create a dedicated user

sudo adduser toto sudo passwd toto

Automatic login

Edit /etc/lightdm/lightdm.conf for example using the command:

sudo nano /etc/lightdm/lightdm.conf

and correct it according to this template to enable:

[LightDM] ... autologin-user = toto ... [Seat:*] ... autologin-user = toto ...

Save, exit, and test with the command:

sudo service lightdm restart

Disable sleep mode and keep the screen on

Open and edit ~toto/.config/lxsession/LXDE/autostart (where ~toto = /home/toto) and comment out the xscreensaver command. Example:

@lxpanel --profile LXDE @pcmanfm --desktop --profile LXDE #@xscreensaver -no-splash

Create the text file ~toto/.xsessionrc to disable sleep mode:

# Turn off default screensaver xset s off # Turn off default standby, hibernate, ... after n minutes xset -dpms

Display the web page in full screen

To do this, we will script what needs to be done at the launch of LXDE.

Create the file /usr/local/bin/tv-start.sh:

sudo nano /usr/local/bin/tv-start.sh

... and write the following inside:

chromium --app="https://commentcamarche.net" --start-maximized & xdotool search --sync --onlyvisible --class "Chromium" windowactivate key F11 unclutter -idle 0.01 -root

Three things are achieved:

  1. Launch the chromium browser (the command should immediately adapt with chrome, with firefox it needs to be looked up), on the correct page, in full screen
  2. Hide the tabs / bars of chromium (full screen mode)
  3. Hide the mouse cursor

Save, exit, and adjust the permissions of this script:

sudo chown root:root /usr/local/bin/tv-start.sh sudo chmod 755 /usr/local/bin/tv-start.sh

Launch the script at LXDE startup

Now we will add this script to the startup of the LXDE session of user toto by modifying ~toto/.config/lxsession/LXDE/autostart as follows:

@lxpanel --profile LXDE @pcmanfm --desktop --profile LXDE #@xscreensaver -no-splash @tv-start

Test:

sudo service lightdm restart

Good luck

0