js_tutorial

Javascript Example Try

Javascript Example Try the following example. It shows how to refresh a page after every 5 seconds. You can change this time as per your requirement. setTimeout("location.reload(true);", t); This page will refresh every 5 seconds. Output This page will refresh every 5 seconds. How Page Re-direction Works? The implementations of Page-Redirection are as follows. Example 1 It is quite simple to do a page redirect using JavaScript at client side. To redirect your site visitors to a new page, you just need to add a line in your head section as follows.

Javascript window.location="http://www.tutorialspoint.com"; } //--> Click the following button, you will be redirected to home page. Output Click the following button, you will be redirected to home page. Redirect Me Example 2 You can show an appropriate message to your site visitors before redirecting them to a new page. This would need a bit time delay to load a new page. The following example shows how to implement the same. Here setTimeout() is a built-in JavaScript function which can be used to execute another function after a given time interval.