Hi everyone,
I am working on a cms and I have a button which will open a window where the users can input data.
I bound a beforeunload event, but it does not always work.
Anyone have any ideas? Here is my code:
- $('#addText').live('click', function(e) {
- $(window.open("http://www.website.com/cms/addText.html", "mywindow", "menubar=1,resizable=1,width=550,height=450")).bind('beforeunload', function() {
- $(this).unbind('beforeunload');
- loadFreshContent('text');
- });
- });
Those two lines don't get called when I close the window, at least not always:
- $(this).unbind('beforeunload');
- loadFreshContent('text');
Thanks in advance for any help and tips!