HTML Code to reload webpage once -...

User 462989 Photo


Registered User
53 posts

I am trying to refresh/reload a page (from the server) once only, when it has completed the initial load.
I have placed the following code at the end of the HTML Body:

<div class="html-element html-element-15">
<script>
window.location.reload(true);
</script>
</div>

My challenge is that it keeps on reloading??
Can anybody give me some guidance, please?
The page is:
https://www.settlersgonubie.co.za/form-solarpanel.html

Thank you
Nick
User 379556 Photo


Registered User
1,558 posts

There are various suggestions on these pages. I don't know which is best, but I guess you'll find at least one that works for you.

https://www.geeksforgeeks.org/how-to-re … avascript/

https://stackoverflow.com/questions/616 … javascript

https://www.lampdocs.com/how-to-reload- … avascript/

Frank
User 462989 Photo


Registered User
53 posts

Hi Frank
Thank you very much for the links - I will certainly follow up on them and try out some options!
Kind regards
Nick
User 3124503 Photo


Guest
1 post

Thanks for the links! I found something useful for myself too, had a similar problem! Now I'm trying to solve it!
User 3124981 Photo


Guest
5 posts

<script>

function reloadIt() {
if (window.location.href.substr(-2) !== "?r") {
window.location = window.location.href + "?r";
}
}

setTimeout('reloadIt()', 1000)();

</script>

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.