How to redirect a user from one webpage to another webpage using Jquery/Javascript?

Introduction

In this article I am going to tell you how to redirect a user from one webpage to another webpage using Jquery or Javascript. For this excercise, you can use any javascript editor

By using window.location

window.location.href = ‘https://techstudys.com’

document.location.href = ‘/path-of-the-webpage’

window.location.replace(‘https://techstudys.com’)

window.location.assign(‘https://techstudys.com’)

By using jQuery

$(location).attr(‘href’,’https://techstudys.com’)

$(window).attr(‘location’,’https://techstudys.com’)

$(location).prop(‘href’, ‘https://techstudys.com’)

Leave a Comment