最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

internet explorer - Javascript window.open returns null in 32-bit IE8 on Win7 x64 - Stack Overflow

programmeradmin3浏览0评论

I have read the related questions on this topic, but haven't yet found a solution to this issue. I have a simple javascript function that calls window.open when a link is clicked:

var newwindow;
function pop(url)
{
    newwindow=window.open(url,'','height=500,width=532');
    if (window.focus) {newwindow.focus();}
}

This works fine on Chrome, Firefox, and even works in 64-bit IE 8. However, when I try this in 32-bit IE 8 I get an error that 'newwindow' is null or not an object.

Any ideas on why this would occur only in 32-bit IE 8?

My hunch was that it was related to UAC in Windows 7 (I am running Win 7 x64), but I get the error even after turning Protected Mode off and running with Compatibility View on.

I also wonder why Windows 7 x64 es with both the 32-bit and 64-bit versions of IE 8, and why the 32-bit version was pinned to my taskbar...

I have read the related questions on this topic, but haven't yet found a solution to this issue. I have a simple javascript function that calls window.open when a link is clicked:

var newwindow;
function pop(url)
{
    newwindow=window.open(url,'','height=500,width=532');
    if (window.focus) {newwindow.focus();}
}

This works fine on Chrome, Firefox, and even works in 64-bit IE 8. However, when I try this in 32-bit IE 8 I get an error that 'newwindow' is null or not an object.

Any ideas on why this would occur only in 32-bit IE 8?

My hunch was that it was related to UAC in Windows 7 (I am running Win 7 x64), but I get the error even after turning Protected Mode off and running with Compatibility View on.

I also wonder why Windows 7 x64 es with both the 32-bit and 64-bit versions of IE 8, and why the 32-bit version was pinned to my taskbar...

Share Improve this question asked Dec 1, 2009 at 17:15 BarrettBarrett 1,1229 silver badges16 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 10

Internet Explorer seems to return null if the url is outside your current domain. You can work around it by open an empty page first, then navigate the window to the actual url:

var newwindow;
function pop(url)
{
    newwindow=window.open('','','height=500,width=532');
    newwindow.location = url;

    if (window.focus) {newwindow.focus();}
}

I don't know about your other issues, but the reason the 32 bit version is the more visible one by default is that most plugins still don't have 64 bit versions, eg. Flash, so the average user would be very confused when they can't get Youtube to work on their shiny new 64 bit system.

I noticed something similar.

I have a window opened using IE function showModalDialog. On this window, I have a button that calls window.open. This call returns null. Then I opened the same page in normal window, not in modal dialog. This time the button returned null as well, but IE told me that web page wants to open pop-up window wand this was blocked. It gave me an option to unblock it... and it started working in both cases - modal and regular window.

It seems that in Modal mode in IE, IE does not show warnings like popup blocked.

发布评论

评论列表(0)

  1. 暂无评论