0

I was wondering why my codes works fine in chrome but it won't work in IE. I believe object.onunload works in IE too.

function showPopup() {
  myPopup = window.open("", "", "dialogWidth:500px;dialogHeight:500px");
  myPopup.onunload = function() {
    alert("Your popup has been closed.");
  }
}
<a href="javascript:showPopup();">Click me for popup</a>
Cille
  • 113
  • 1
  • 1
  • 7
  • Behaves as expected in IE11 for me - what version are you using? – Emissary Jun 19 '17 at 09:20
  • 1
    Emulation suggests it only "doesn't work" in 7 & 8 - but you shouldn't be supporting these. – Emissary Jun 19 '17 at 09:23
  • @Emissary I tested IE 5 up to Edge but it won't work. I don't know what went wrong. – Cille Jun 19 '17 at 09:23
  • Is your browser in quirks mode or compatibility mode? – Emissary Jun 19 '17 at 09:27
  • I change ie versions in F12 – Cille Jun 19 '17 at 09:33
  • Okay but there isn't an issue with the code you've posted, it's either an issue with the document or your environment - all I can suggest is make sure your document has an appropriate [doctype](https://stackoverflow.com/questions/6076432) and for sanity, if you're working locally [disable intranet compatibility view](https://stackoverflow.com/questions/25557299). – Emissary Jun 19 '17 at 09:41

0 Answers0