0
How can I learn web page back link ?
To conect all web pages togather by onclick.
2 ответов
+ 1
If you mean to go 1 URL back in the browsing history, you can do:
window.history.back();
More details on that at: https://www.w3schools.com/jsref/met_his_back.asp
The best way to link a page to another page is with HTML's a tag and href attribute. That is explained in detail here:
https://www.w3schools.com/tags/att_a_href.asp
If you really need to use JavaScript:
window.location = "https://www.google.com";
You could have an onclick="myRedirect()" set on some element and the function implemented like:
function myRedirect()
{
window.location = "https://www.google.com";
}
Avoid using JavaScript if you can. None of the many sites I made have back buttons like you might be suggesting because the browser has one anyway and there is usually a better way to suggest places to navigate.
0
Or you can try
history.go(-1)
For previous page
And
history.go(1)
For next page in js.