May 29, 2013

jQuery redirect page, with javascript alternative

jQuery javascript frameworkjQuery redirect one page to another using the following code:

var your_url = ''; //change this to your url

Above code works to redirect page in jQuery, but javascript code is good alternative here.

Using javascript to redirect your page using below code, which is better than jQuery, will do the job:


Another javascript approach which will mock as if the URL is being clicked to redirect is:

window.location.href = "";

Even this will do the trick in javascript, which sets your URL in a window object and assigns it to anchor tag’s href attribute automatically:

window.location = "";

Leave a comment


Welcome to my Blog

Kalpesh MehtaHelping Magento developers in their day-to-day development problems since 2011. Most of the problems and solutions here are my own experiences while working on different projects. Enjoy the blog and don't forget to throw comments and likes/+1's/tweets on posts you like. Thanks for visiting!