Redirecting a webpage in JavaScript

Redirects are way of navigating a user to another webpage or location

redirects are normally done by server side implementations.

it's possible to do redirects using JavaScript too

window.location is a object that stores current location information such as path, port, hostname and href or the location in the address bar of your browser changing it invokes a redirect it's a simple way to redirect a user to another webpage

Syntax
window.location.asign('https://example.com')

or simply like

window.location = "https://example.com"

or simply omit window

location = "https://example.com"

Comments

Popular posts from this blog

Open-graph meta data tags introdution

What is 'this.' keyword in JavaScript

How to create zip archives in nodejs

what is 'array.includes' function in JavaScript

How to build a twitter retweet bot using JavaScript