SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
-
Jul 31, 2007, 13:52 #1
- Join Date
- Apr 2007
- Posts
- 690
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is there a javascript function that will...
Is there a javascript function that when you press the close button at the top right hand corner of your browers will prompt you and say:
Are you sure you want to close:
yes or no
Thanks.
-
Jul 31, 2007, 14:05 #2
- Join Date
- Nov 2005
- Location
- Trinidad
- Posts
- 3,746
- Mentioned
- 45 Post(s)
- Tagged
- 0 Thread(s)
There's such a thing as an "onunload" event.
You can have "window.onunload", which will be triggered when the window is closed.
Trying to fill the unforgiving minute
with sixty seconds' worth of distance run.
Update on Sitepoint's Migration to Discourse
-
Jul 31, 2007, 18:59 #3
- Join Date
- Apr 2007
- Posts
- 690
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is there a way to disable the exit or back button then?
-
Jul 31, 2007, 19:32 #4
- Join Date
- Jul 2007
- Location
- Virginia
- Posts
- 87
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:<html> <head> <title>test</title> <script language="javascript" type="text/javascript"> window.onbeforeunload = keep_open; function keep_open(){ return "Are you sure you'd like to exit this page?"; } </script> </head> <body> MY WEB SITE!!!! </body> </html>
-
Jul 31, 2007, 20:07 #5
- Join Date
- Nov 2005
- Location
- Trinidad
- Posts
- 3,746
- Mentioned
- 45 Post(s)
- Tagged
- 0 Thread(s)
window.onbeforeunload...
Well I can't say I knew about that one.
Trying to fill the unforgiving minute
with sixty seconds' worth of distance run.
Update on Sitepoint's Migration to Discourse
-
Jul 31, 2007, 20:14 #6
- Join Date
- Nov 2005
- Location
- Trinidad
- Posts
- 3,746
- Mentioned
- 45 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by wickedneat
To disable the back button, all I can think of is to launch a new window or have some blank intermediary page that redirects to the final page, so that if someone clicks "back" they'd return to the blank page and it'd kick them back to your final page regardless.
Of course if they click back multiple times they'd probably get around it.
Last edited by Shaun(OfTheDead); Aug 1, 2007 at 04:46. Reason: typo
Trying to fill the unforgiving minute
with sixty seconds' worth of distance run.
Update on Sitepoint's Migration to Discourse
-
Jul 31, 2007, 20:17 #7
- Join Date
- Nov 2005
- Location
- Trinidad
- Posts
- 3,746
- Mentioned
- 45 Post(s)
- Tagged
- 0 Thread(s)
I don't think there's a way to disable the exit button, though. It'd be too much of a security risk.
Trying to fill the unforgiving minute
with sixty seconds' worth of distance run.
Update on Sitepoint's Migration to Discourse
-
Jul 31, 2007, 22:09 #8
- Join Date
- Jul 2007
- Location
- Virginia
- Posts
- 87
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Bookmarks