call to window.open() returns null on IE 11 + Windows 8.1 Preview

 ̄綄美尐妖づ 提交于 2019-12-10 13:27:27

问题


I am doing somethig like this,where MyConfig is a aspx page.

   winOpen=window.open('/Account/Register','MyConfig','toolbar=no,status=no,location=no,menubar=0,resizable=yes,scrollbars=yes,width=' + wWidth + ',height='+ wHeight + ',top=' + wTop + ',left=' +wLeft);

winOpen.focus();

It returns null.It is working fine in chrome + WIndows 8.1 preview,But it is not working in IE 11.

EDIT

I have added one more line in the question and actually that line is failing since window.open() return null and so is winOpen.focus().I turned to compatibility mode and than launched the page now it is giving me the same WebPage error but I am able to navigate to the page.I wanted it to work in without compatibility mode setting.user might not know the setting.


回答1:


uncheck "Enable Protected Mode" in internet options




回答2:


Your first argument is supposed to be a string, and you are missing a plus sign by wHeight:

winOpen=window.open('/Account/Register','MyConfig','toolbar=no,status=no,location=no,menubar=0,resizable=yes,scrollbars=yes,width=' + wWidth + ',height=' + wHeight + ',top=' + wTop + ',left=' +wLeft);

Edit: Check and make sure your IE allows popups on the site you are using to test. If it does not, and the popup does not open, it will return null. Allowing popups will fix the problem.




回答3:


Same problem with IE 11 on windows 10

At difference than @Khodor workaround, I get the expected behavior doing this:

  1. Open internet options popup.
  2. Select security tab.
  3. Check 'Enable Protected Mode'.
  4. Close and Open IE again.

I thougt that the null was caused for 'not found' response, ssl, different domain, etc. I tested and dicarded all of them.



来源:https://stackoverflow.com/questions/18503880/call-to-window-open-returns-null-on-ie-11-windows-8-1-preview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!