CodesJava

Easy learning with example program codes

Redirect a url using javascript


We can use window.location.replace(…) or window.location.href to redirect a url using javascript.

//Behave as an HTTP redirect
window.location.replace("https://codesjava.com");

//Behave as clicking on a link
window.location.href = "https://codesjava.com";

Related topics:

Please follow and like us:


Copyright © 2019 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki