This question already has answers here:
Prevent a webpage from navigating away using JavaScript
(10 answers)
Prevent user to leave my page in javascript
(2 answers)
Closed 4 years ago.
I'm trying to make an online test using spring-mvc and html, css, jquery and I want to prevent the user that is doing the test from leave the test screen while doing the test. Does anybody know how I can do that?
Related
This question already has answers here:
How to detect the printed status or canceled status in web browser using javascript?
(1 answer)
Is there a way to track if a user prints a web page?
(8 answers)
Closed 3 years ago.
How the way get feedback from button click cancel and print.
For example, if I click cancel button, show 0, if click print show 1.
This question already has answers here:
Back button redirect script
(2 answers)
Closed 6 years ago.
I would like to direct the visitor to a different link, once he clicks the "back" button on his browser. I know that it can be done :)
I tried to play with the history of the browser but it didn't work
Thanks!
Elad
Im not sure if this will work since i have never tried this..but here you go:
window.addEventListener('popstate',function() {
window.location.href="www.example.com"/*url you want";
}
You can refer this for further information
https://developer.mozilla.org/en-US/docs/Web/API/Window/history
This question already has answers here:
Identifying Between Refresh And Close Browser Actions
(13 answers)
How can I detect browser tab refresh or close using javascript [duplicate]
(3 answers)
Closed 7 years ago.
How can I distinguish browser close and reload/refresh/f5 though jQuery/JS? I want to update database (via ajax) when close browser/tab and keep all as it is when reload.
What I am doing now is same action running when reload or close. But after reload again run a restore function (via ajax) to set back in previous state.
Tried How can I detect browser tab refresh or close using javascript not worked. Any Idea? cron job is not real time. I need real time action
Professionals help please how you handle this issue.
This question already has answers here:
Change the URL in the browser without loading the new page using JavaScript
(14 answers)
Closed 8 years ago.
The URL on this page seems to change when I click in the comments section where it says "x More...".
How this this URL trickery happen?
It is part of the HTML5 history api.
This question already has answers here:
Is there a cross-browser onload event when clicking the back button?
(15 answers)
Closed 9 years ago.
What event can i use to run code when a user visits another page then hits back to load my page again?
I wrote window.onload = function() { ... and it works when i hit refresh but not forward then back.
This jQuery plugin is pretty good. http://www.asual.com/jquery/address/docs/
And here's some info on the underlying JavaScript events involved in it's implementation http://www.hunlock.com/blogs/Mastering_The_Back_Button_With_Javascript