Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
How to redirect a page to another page in Javascript?
Home
JavaScript
How to redirect a page to another page in Javascript?
+1
vote
asked
Jul 16, 2019
in
JavaScript
by
Indian
How to redirect a page to another page in Javascript?
#java-script
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jul 16, 2019
by
Indian
Using location.href:
It is the first approach to redirect page. In this, we can go back to access the original document.
Syntax
:window.location.href =“
https://www.madanswer.com/”
Using location.replace:
Another approach to redirect page. In this, it is not possible to navigate back to the original document by clicking on the back button as it removes the URL of the original document.
Syntax:
window.location.replace("
https://www.madanswer.com/;");
...