0

i created a popup with an iframe which call pop.html in the pop.html, i have two button, enter and exit when a user click the button exit , i want to unload the popup and when the user click enter, it will exit the popup and go to the anchor link. the problem is the window.unload is not working, any idea? thanks

 <a onclick="window.onbeforeunload = null;" href="contest" >Enter</a>
 <a onclick="window.onbeforeunload = null;" >Close Popup</a>

Note: the button is located inside the 'popup iframe' my main site is index.html and the button is located in.pop.html which is the popup iframe content

JeVic
  • 681
  • 1
  • 11
  • 33
  • 1
    Are these buttons inside the iframe or inside the parent window? – Jonathan May 11 '15 at 23:42
  • See http://stackoverflow.com/q/24688268/2801559 – guest271314 May 12 '15 at 00:29
  • that is not what I was looking for, the button is located inside the iframe/popup and when the button is click inside the popup it will close the popup – JeVic May 12 '15 at 00:49
  • @JeVic Can create jsfiddle http://jsfiddle.net to demonstrate ? – guest271314 May 12 '15 at 01:22
  • not possible it has two files, this is what my popup contains http://pastebin.com/fu7qfdah the popup opens up in a lightbox – JeVic May 12 '15 at 06:49
  • @JeVic I'm a little confused: you said the two lines in your original question were inside of the iframe, but the pastebin you linked to doesn't contain those lines anywhere. Can you post the parent window HTML as well? Also, there are several errors in your pastebin: `http://` but no domain name in your `script` tags, and two `onclick`'s on your first link. – Jonathan May 14 '15 at 22:31
  • i am using a lightbox script popup from ninja popup. the link was revised as i was trying several method. it has not http because it is located in the root – JeVic May 15 '15 at 02:03

1 Answers1

0

Already found a solution

<a href="javascript:parent.jQuery.fancybox2.close();"><img src="myCloseButton.png"
alt="close fancybox" /></a>
JeVic
  • 681
  • 1
  • 11
  • 33