I have been trying to make a autostart script to opens up a web page in fullscreen mode

sudo nano .config/lxsession/LXDE-pi/autostart

@chromium-browser --kiosk --disable-restore-session-state www.domain.com

this one works but i also want to refresh the page like every 10 minutes. I'm trying to write a code to do that

sudo nano .config/lxsession/LXDE-pi/autostart

@/usr/bin/python /home/pi/PATH/TO/SCRİPT.py

like this should work but im not sure how a loop or delay will effect the system. Should i make it run at backround and if so how can i?

I know there are many answers Execute script on start-up in this topic but i couldn't find an answer to refreshing and making a loop at autostart script.

This is my first question. Please let me know if i make some formatting errors.


How to refresh and creating script is explained in https://www.raspberrypi.org/forums/viewtopic.php?t=163316 this topic but still i have no idea how that will effect my system and is it okay to do it that way.

If you own the web-page being displayed, just add a META refresh tag to it like this:

<META HTTP-EQUIV="refresh" CONTENT="600">

If you don't own the page being displayed, you can wrap it in an invisible IFrame that refreshes it's contents every so often.

Here's some code for that IFrame I found somewhere on the net (not my code! - If I could attribute it I would)...

<html>
    <style>
        body{padding:0;margin:0;}
        iframe{width: 100%;height: 100%;border:0;}
    </style>

    <iframe id="theframe" src="http://example.com"></iframe>

    <script type="text/javascript">
        var iframeEl = document.getElementById('theframe');
        var url = iframeEl.src;
        iframeEl.src = 'about:blank';
        setInterval(function() {
            var ts = new Date().getTime()
            iframeEl.src = url + '?ts=' + ts;
        }, 600000 /* 10 minutes in milliseconds  */ );
</script>
</html>

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.