How to Redirect a Webpage using jQuery?

Share This Post

Redirecting a user from one page to another, or even from your website to another, maybe accomplished in a variety of ways.

We’ll go through how to achieve this operation utilizing the jQuery library as well as pure JavaScript in this tutorial.

How to redirect to another page using jQuery?

Using jQuery to redirect a visitor to a different website is a simple one-liner.

Remember that this solution relies on the jQuery library, so make sure it’s installed before running the code. For this reason, the second solution is given above, which uses pure JavaScript, is preferable.

jQuery Solution


Let’s take a look at the vanilla JavaScript version, which is slightly different but preferable.

How to Redirect a Webpage using Pure Javascript?

The vanilla JavaScript version of this code is also a simple one-liner.

window.location.href = "";

It’s as simple as that. You now know how to use jQuery to redirect a webpage. Unless you’re dead set on using jQuery, opt for the second pure JavaScript solution.


Please enter your comment!
Please enter your name here

Related Posts

How to Delete an Element by Key from an Array in PHP?

There are several ways to work with arrays in...

Manually Checking Your Computer For Windows 10 Compatibility

Many of the worries about upgrading to Windows 10...

Apple Music Classical app references again spotted in iOS code

More Apple Music Classical app references have been discovered...

Mysterious Wallet Whale Buys 3 Trillion Shiba Inu Tokens in One Transaction

3.37 trillion Shiba Inu Tokens were Acquired in one...
- Advertisement -spot_img