Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
77
rated 0 times [  82] [ 5]  / answers: 1 / hits: 20699  / 9 Years ago, fri, may 29, 2015, 12:00:00

I want to disallow the visitor go back in browser, I tried the code here (How to disable back button in browser using javascript) and works well, but I want to make somenthing more useful for my application. I want to change the back url.



So, if the back URL is mywebsite.com/admin/add_new_article.php I want to change the back URL to mywebsite.com/admin/index.php



Thank you all!


More From » php

 Answers
6
<script type=text/javascript>
history.pushState(null, null, '<?php echo $_SERVER[REQUEST_URI]; ?>');
window.addEventListener('popstate', function(event) {
window.location.assign(http://www.yoururl.com/);
});
</script>


Hope it helps!


[#66413] Wednesday, May 27, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
armandoh

Total Points: 208
Total Questions: 94
Total Answers: 112

Location: South Sudan
Member since Sun, Jul 11, 2021
3 Years ago
;