问题
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:
- Open internet options popup.
- Select security tab.
- Check 'Enable Protected Mode'.
- 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