1

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.

1 Answer 1

1

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>
1
  • 1
    Or, you could install a Chrome extension that refreshes your pages automatically.
    – Botspot
    Sep 9, 2019 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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