www.webdeveloper.com
Results 1 to 5 of 5

Thread: Disabling "Are you sure you want to navigate away from this page" warning?

  1. #1
    Join Date
    Dec 2010
    Posts
    2

    Disabling "Are you sure you want to navigate away from this page" warning?

    I was wondering if somebody could tell me how to disable the warning mentioned in the title. I have pop-ups that require passwords, and when entered and submitted redirect to another page. I'd prefer this to be seamless, but I need to get rid of the warning message first.

    Anybody know how?

  2. #2
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,773
    In the window object's unload event, a confirm() function call is probably causing this. You could try setting window.onunload = null; some place in JavaScript to see if that short circuits the dialog.

    Really though, we need to see the code generating this confirm window. Tracking that code down will be your first step.

  3. #3
    Join Date
    Dec 2010
    Posts
    2
    I just copied/pasted from a website, didn't feel like taking the time to write my own code. I'm terrible with javascript, or programming in general. Anyway, this is basically what it is.

    HTML Code:
    <html>
    <HEAD>
    
    <noscript></noscript><!-- --><script type="text/javascript" src="http://www.freewebs.com/p.js"></script><script type="text/javascript">
    <!-- Begin
    /* This script and many more are available free online at
    The JavaScript Source :: http://javascript.internet.com
    Created by: Javascript Newbie :: http://expage.com/javascriptnewbie
    */
    
    var password;
    var pass1 = "s7edr"; // place password here
    
    password=prompt("Please enter password #3:","");
    
    if (password==pass1) {
      window.location= "http://42637.webs.com"; // file to open if password is correct
    } else {
      window.location= "blank.html"; // file to load if password is incorrect
    }
    // End -->
    </script>
    <!-- --><script type="text/javascript" src="http://images.webs.com/static/global/js/webs/usersites/escort.js"></script><script type="text/javascript">if(typeof(urchinTracker)=='function'){_uacct="UA-230305-2";_udn="none";_uff=false;urchinTracker();}</script></head>

  4. #4
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,773

  5. #5
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,773

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles