here is my problem: I need to display the message for a while and then reload the page. can someone tell me how to reload the page after a certain delay?
You don’t even need jQuery or HTML5 for this:
setTimeout(location.reload.bind(location), 60000);
This will wait 1 minute (60,000 milliseconds), then call the function location.reload, which is a built-in function to refresh the page.
location.reload
setTimeout(function(){ window.location.reload(); // you can pass true to reload function to ignore the client cache and reload from the server },delayTime); //delayTime should be written in milliseconds e.g. 1000 which equals 1 second
Update:
Single line using ES6:
setTimeout(() => window.location.reload(), delayTime);
js, :
<meta http-equiv="refresh" content="5"/> <!-- 5 sec interval--> <h1>Page refersh in every 5 seconds...</h1>
, Google
<meta http-equiv="refresh" content="5;http://www.google.com"/> <!-- 5 sec delay--> <h1>Redirecting in 5 seconds...</h1>
Source: https://habr.com/ru/post/1545938/More articles:Regular expression to keep matches, delete others - regexПервый пример базы данных ServiceStack - servicestackCombining two awk teams in one team - unixUnicodeDecodeError: ascii codec cannot decode bytes at position: serial number not in range (128) - encodingUndefined Method URL for Mailer Attachment Application - ruby-on-railsPython --- How to execute a command line and get output from it? - pythonMessage about removing HTTP using a request module - pythonКак сделать равное пространство между ящиками в одной строке с помощью CSS - cssA program running on Cygwin does not report that the exception is c ++How to embed DbGeography in SQL Server using dapper - c #All Articles