Redirect Web Page using javascript/jQuery

If you want to redirect your visitors to a new page place the following HTML redirect code between the and tags of your HTML code.

window.location.replace(…) is the best option for an HTTP redirect.
window.location.replace(“http://myurl.domain”);

Redirect clicking on a link
window.location.href = “http://myurl.domain”;

jQuery Redirect: It is better than using window.location.href =, because replace() does not put the originating page in the session history.
If you want to simulate an HTTP redirect, use location.replace.

var myurl = “http://myurl.domain”;
window.location.href = ‘myurl’;

Share this nice post:

2 thoughts on “Redirect Web Page using javascript/jQuery

  1. Hi there, You have done an incredible job. I will certainly digg it and personally recommend to my friends. I am sure they will be benefited from this website.

Leave a Reply

Your email address will not be published. Required fields are marked *