Is there any way to reload a page without resetting Javascript code that is currently running on the page (for example, being run via the Chrome dev console)?
My situation is that I have a page that I need to keep reloading and running code on automatically. However, whenever I refresh the page using window.location.reload( ) it stops any Javascript that I'm currently running on the page.
Is there any way that I can keep refreshing the page but keep running the same code?
Thanks to dandavis for this answer.
By using ajax, I was able to select a div that encompassed the page and selectively reload it. Effectively, this means that the contect of the page was refreshed.
The code looks something like this:
$('#mydiv').load(document.URL + ' #mydiv');
Example (where middle is the ID of the div):
$('#middle').load(document.URL + ' #middle');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With