There are three pages, A, B and C. A has a tag whose href redirects to B. B has JavaScript Code and redirects to C. When in C, I click browser back button, browser redirects to A. Why not B ? Thank you in advance.
Test Links Page A: http://o17o2o.com:8000/article-href.html
Page A
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Test</title>
</head>
<body>
<a href="/href-redirect.html">click me</a>
</body>
</html>
Page B
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>waiting</title>
</head>
<body>
Page B
<script type="text/javascript">
window.location.href = '/original.html';
</script>
</body>
</html>
location.href redirect will only add to browser history if it is from user initiated action. Here you are calling it on onload event so it wont be added to history
user History.pushState to insert in browser history
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With