Redirecting the Web Page

location.href="newpage.html"; location.href="http://jqueryin24/index.html;

Another extremely useful feature of JavaScript is the ability to redirect the browser away from the current URL to another location. You do this by setting the location.href value to a new URL. The new URL can be a full address, such as http://mysite.com/newlocation/index.html, or a relative location to the current URL, such as page2.html.

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.