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

Meta to face a trademark lawsuit over its infinity-symbol logo

The rebranding or transformation of Facebook to Meta has...

45+ Happy Labor Day Wishes, Messages, Greetings and Quotes

Labor Day, also known as International Workers Day, is...

Android Users: How to add songs from Youtube Music to Snapchat

Snapchat has begun to roll out a feature that...

4 Easy ways to get unbanned from Omegle

If you enjoy chatting on the platform Omegle, you...

Fix “running as root without –no-sandbox” Error in Puppeteer

The Google Dev Team's Puppeteer is a strong tool...

Tips for enhancing the FaceTime call experience on iPhone, iPad, and Mac

With the introduction of iOS 15 and macOS Monterey...
- Advertisement -spot_img