Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create auto refresh from static html website

Tags:

html

refresh

I have following problem with my website. I created very simple website for my family (including my grandfather) but they don't know much about internet. That is why I have to create auto refresh when they open a website.

My website is here: http://kartingsiemianowice.pl/ (please don't look at the code, because it was created just for few days).

Can you let me know how can I create refresh when they open a website? Because when I will change something and send these files to FTP then they have to refresh page.

like image 219
user3097025 Avatar asked Dec 05 '25 12:12

user3097025


2 Answers

Best HTML code placed in head section of the website works good in all browsers.

<head> <meta http-equiv="refresh" content="60"> </head> 

Where meta will say to browser what to do and content is time in seconds.

If you need to transfer your visitor to another domain just use:

<meta http-equiv="refresh" content="2;url=https://mlmos.com/">

where meta will say what to do, content time in seconds, now 2 or as you wish, then order to redirect to any url, in this case mlmos.com

Hope so this simple solution will help!

like image 85
Igor B. Avatar answered Dec 07 '25 00:12

Igor B.


As Minh Quy stated in the comments, you can use the JS function setInterval or setTimeout

Example below :

setInterval(function(){alert("Hello")}, 3000);

setTimeout(function () {
    location.reload();
}, 3000);

The first simple example displays a pop-up alert window every 3 seconds and the second reloads the page after 3 seconds.

So for your purposes, you will need to use this function in conjunction with your existing code to refresh the page when the user visits a specific page or performs a specific action.

like image 33
aphextwix Avatar answered Dec 07 '25 00:12

aphextwix



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!