Results 1 to 10 of 10

Thread: Need a confirmation to leave page script

  1. #1
    Join Date
    Jan 2008
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Need a confirmation to leave page script

    I need a DHTML script that pops up when someone is trying to leave the window (kind of like those light boxes when you zoom in on an image) for an email client, but I don't want it to be a JavaScript alert. Anyone have the script or know how to do this?

    I'd be extremely appreciative as I've been trying for ages now.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I'm sorry, I don't think its possible. But there is a Javascript way if you like:
    Code:
    <script type="text/javascript">
    window.onbeforeunload = function(){ return "Are you sure you want to leave the page?"; }
    </script>
    Jeremy | jfein.net

  3. #3
    Join Date
    Jan 2008
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Nile View Post
    I'm sorry, I don't think its possible. But there is a Javascript way if you like:
    Code:
    <script type="text/javascript">
    window.onbeforeunload = function(){ return "Are you sure you want to leave the page?"; }
    </script>
    I have loads different ways to do it with javascript but this is for a client who wants a popup. How about a javascript event that triggers a DHTML one?

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Don't think so... Sorry.
    Jeremy | jfein.net

  5. The Following User Says Thank You to Nile For This Useful Post:

    Falah (10-29-2009)

  6. #5
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Not sure if this is the same or different havent looked at it in a while

    http://www.dynamicdrive.com/forums/s...ighlight=leave

  7. #6
    Join Date
    Jan 2008
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by bluewalrus View Post
    Not sure if this is the same or different havent looked at it in a while

    http://www.dynamicdrive.com/forums/s...ighlight=leave
    kind of, but you know how those pages have the chat that pops up also with a person saying "Hi, how can I help you?" or whatever also when the javascript message pops up.

    I want something that does that. If I find a link to one again I'll post it.

  8. #7
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Bluewalrus, I already suggested that... And what I think you're talking about is a JS Modal Window, preferably something like this. Correct?
    Jeremy | jfein.net

  9. #8
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Yea something like the window one close window but in an alert so it's outside of the window. I didn't have time to test that code i post the link to. I thought when i tested it before it had a confirm in an alert type window though.

  10. #9
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I don't understand bluewalrus. Your code was fine, it just wasn't what he was looking for. I was trying to say that I already suggested the code you provided.
    Jeremy | jfein.net

  11. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Personally if some web site warned me when I was leaving it, it would have to be a really good web site for me to ever bother returning to it. And I think most people feel this way.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •