detect where a redirect wants to go with jQuery

Posted by Markus on Stack Overflow See other posts from Stack Overflow or by Markus
Published on 2010-05-12T08:13:45Z Indexed on 2010/05/12 8:54 UTC
Read the original article Hit count: 158

Filed under:

Hi there,

I have a page with a flash plugin. If I'm on that page, I don't want to post a message if the user wont to leaf it without saving it...:

if(/containers/.test(document.location.href)){
    window.onbeforeunload = function(){
      return exit_text;  
    };
}

This works fine, except that I if i save the content in the flash plugin. In that case I don't want to show up that message. How can I detect the url within the onbeforeunload method? That way I can descide when to post the method!

Thanks Markus

© Stack Overflow or respective owner

Related posts about jQuery