The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Are you sure you want to navigate away from this page

View previous topic View next topic Go down

Solved Are you sure you want to navigate away from this page

Post by xrisinkaa on July 5th 2012, 1:18 am

I have a web page - www.all-serials.net that contains a textbox and a submit button. When the user edits the text in the textbox and clicks another link (not the submit button) how do I display the 'Are you sure you want to navigate away from this page' popup message? I want some code or IDK.. My version is PunBB (punbb)

xrisinkaa
Forumember

Female Posts : 139
Reputation : 0
Language : bulgarian

http://www.all-serials.net/

Back to top Go down

Solved Re: Are you sure you want to navigate away from this page

Post by LGforum on July 5th 2012, 1:45 am

You would use the window.onunload event by attaching an event handler. The handler would ask the user if they wish to leave.

LGforum
Hyperactive

Male Posts : 2260
Reputation : 258
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Solved Re: Are you sure you want to navigate away from this page

Post by xrisinkaa on July 5th 2012, 1:58 am

Can u give me the code pls and instructions how to put this code Smile

xrisinkaa
Forumember

Female Posts : 139
Reputation : 0
Language : bulgarian

http://www.all-serials.net/

Back to top Go down

Solved Re: Are you sure you want to navigate away from this page

Post by xrisinkaa on July 5th 2012, 11:07 pm

Its not working Sad

xrisinkaa
Forumember

Female Posts : 139
Reputation : 0
Language : bulgarian

http://www.all-serials.net/

Back to top Go down

Solved Re: Are you sure you want to navigate away from this page

Post by LGforum on July 5th 2012, 11:20 pm

Try this:
Code:

(function(b){
  var f = function() { return confirm('Are you sure you wish to leave?'); };
  if(b.attachEvent) {
    b.attachEvent('onunload', f);
  }
  else {
    b.addEventListener('unload', f, false);
  }
})(document.body);

LGforum
Hyperactive

Male Posts : 2260
Reputation : 258
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Solved Re: Are you sure you want to navigate away from this page

Post by xrisinkaa on July 5th 2012, 11:22 pm

Nope.. its not working Sad

xrisinkaa
Forumember

Female Posts : 139
Reputation : 0
Language : bulgarian

http://www.all-serials.net/

Back to top Go down

Solved Re: Are you sure you want to navigate away from this page

Post by LGforum on July 5th 2012, 11:35 pm

I'm not sure if unload event is fired when clicking links to a new page. Only clicking back/forward and closing or reloading the page.

Might have to think of an alternative way.

LGforum
Hyperactive

Male Posts : 2260
Reputation : 258
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Solved Re: Are you sure you want to navigate away from this page

Post by xrisinkaa on July 6th 2012, 1:06 am

I post ur code in java.. click in 1 topic, write something in quick reply and then click F5 to refresh the page.. and nothing.. i lost my message

xrisinkaa
Forumember

Female Posts : 139
Reputation : 0
Language : bulgarian

http://www.all-serials.net/

Back to top Go down

Solved Re: Are you sure you want to navigate away from this page

Post by xrisinkaa on July 6th 2012, 4:03 pm

its not working arww :@@@

xrisinkaa
Forumember

Female Posts : 139
Reputation : 0
Language : bulgarian

http://www.all-serials.net/

Back to top Go down

Solved Re: Are you sure you want to navigate away from this page

Post by Proxy*64* on July 6th 2012, 5:47 pm

And do you tick "In all pages"?

Proxy*64*
Forumember

Male Posts : 113
Reputation : 6
Language : English,Greek|HTML/CSS/jQuery

http://fataola.forumgreek.com

Back to top Go down

Solved Re: Are you sure you want to navigate away from this page

Post by xrisinkaa on July 7th 2012, 12:42 am

Yes java is turning on and tick to all pages, but now its working the other admin put the link in css i think idk.. and now its working.. thanks for codes Smile

xrisinkaa
Forumember

Female Posts : 139
Reputation : 0
Language : bulgarian

http://www.all-serials.net/

Back to top Go down

Solved Re: Are you sure you want to navigate away from this page

Post by Sanket on July 7th 2012, 6:46 am

Topic Solved & Locked

Sanket
ForumGuru

Male Posts : 48766
Reputation : 2819
Language : English
Location : Mumbai

http://webartzforum.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum