Results 1 to 4 of 4

Thread: Back buttton

  1. #1
    Join Date
    Nov 2005
    Posts
    1
    Rep Power
    9

    Default Back buttton

    Hey guys i remember coming to the site a while ago and seeing a tutorial on how you did the prompt when you try to leave the page. I'd really love some insight into this. i had a function that kind of works, very simple:

    body.onunload = "javascript: try_leaving();"

    function try_leaving(){
    var leave = prompt("are you sure you want to leave");
    if(!leave) location=self.location;
    }

    the problem is it's an ajax app and it refreshes the whole page, restarting the app. please help.

  2. #2
    Join Date
    Sep 2005
    Posts
    2,103
    Rep Power
    14

    Default return an error, right?

    If it's anything like the onsubmit stuff, just returning an error will cancel the navigation...

  3. #3
    Join Date
    Aug 2005
    Location
    San Mateo, CA
    Posts
    4,789
    Rep Power
    19

    Default

    Quote Originally Posted by entone
    Hey guys i remember coming to the site a while ago and seeing a tutorial on how you did the prompt when you try to leave the page. I'd really love some insight into this. i had a function that kind of works, very simple:

    body.onunload = "javascript: try_leaving();"

    function try_leaving(){
    var leave = prompt("are you sure you want to leave");
    if(!leave) location=self.location;
    }

    the problem is it's an ajax app and it refreshes the whole page, restarting the app. please help.
    We have this in our next release.

  4. #4
    Join Date
    Aug 2005
    Posts
    49
    Rep Power
    10

    Default

    Quote Originally Posted by entone
    Hey guys i remember coming to the site a while ago and seeing a tutorial on how you did the prompt when you try to leave the page. I'd really love some insight into this. i had a function that kind of works, very simple:

    body.onunload = "javascript: try_leaving();"

    function try_leaving(){
    var leave = prompt("are you sure you want to leave");
    if(!leave) location=self.location;
    }

    the problem is it's an ajax app and it refreshes the whole page, restarting the app. please help.
    Try the following:

    Code:
    window.onbeforeunload = confirmExitMethod;
    When the user attempts to navigate away from your site the confirm exit method (below) will be called:

    Code:
    function confirmExitMethod {
    	return "Danger! Danger! Leaving the App!";
    }
    Returning a string from confirmExitMethod will cause the browser to pop-up an alert displaying the returned string. If this method returns null, then no warning dialog will be presented to the user.

Similar Threads

  1. loops back to myself
    By cubitus91 in forum Installation
    Replies: 16
    Last Post: 05-12-2008, 12:49 PM
  2. mail from localhost loops back to myself
    By steve11523 in forum Installation
    Replies: 28
    Last Post: 07-16-2007, 07:40 AM
  3. Checking the bounced back incoming emails
    By mansuper in forum Administrators
    Replies: 1
    Last Post: 07-03-2007, 09:16 PM
  4. i forget my admin password,how can i get it back?
    By nxzwt in forum Administrators
    Replies: 1
    Last Post: 02-12-2007, 05:02 AM
  5. Email Notification and going BACK
    By mansuper in forum Users
    Replies: 1
    Last Post: 08-11-2006, 07:02 PM

Posting Permissions

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