Window.open无法在IE8中运行?

时间:2022-10-22 15:12:32

This is the JavaScript I'm currently using:

这是我目前正在使用的JavaScript:

window.open('/modules/mod_oneononechat/chatwindow.php?key='+key+'&color=blue','x'+winName+'x','location=0,status=0,toolbar=0,menubar=0,resizable=0,scrollbars=0,height=375,width=420');

This doesn't seem to be working in IE8. It's a chat window that works fine on all other browsers (including IE7). Any ideas as to why it's not working on IE8?

这似乎在IE8中不起作用。这是一个聊天窗口,适用于所有其他浏览器(包括IE7)。有关为什么它不能在IE8上工作的任何想法?

11 个解决方案

#1


71  

IE8 doesn't like spaces in the window name.

IE8不喜欢窗口名称中的空格。

#2


4  

Removing the space from the window name solved the problem.

从窗口名称中删除空格解决了这个问题。

#3


4  

In IE8, the below function was not opening a new window pop up whereas it was working perfectly in Mozilla and Chrome.

在IE8中,下面的功能没有弹出一个新窗口,而是在Mozilla和Chrome中完美运行。

function openReports(reportUrl){
   window.open(reportUrl,'Report Information','height=800,width=1000,left=200,top=200,toolbars=no,resizable=no,scrollbars=auto,location=no');
}

Removing the space (Report Information)from the window name solved the problem for me too.

从窗口名称中删除空间(报告信息)也解决了我的问题。

#4


1  

This works for me:

这对我有用:

javascript:window.open('http://google.com', 'x'+'winName'+'x', 'location=0', 'status=0', 'toolbar=0', 'menubar=0', 'resizable=0', 'scrollbars=0', 'height=375', 'width=420');

#5


1  

I too had a problem with this issue. I had written a function like

我也遇到过这个问题。我写了一个像这样的函数

function newPopup(url) {
      popupWindow=window.open(url,'Detailed Informations','height=700,width=1000,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}

where there was a space in the window name i.e "Detailed Information" and due to this the popup was not working. Just dont put any spaces in the window name.

窗口名称中有空格,即“详细信息”,因此弹出窗口无法正常工作。只是不要在窗口名称中添加任何空格。

#6


1  

window.open has three parameters: url, windowname, otherfeatures.

window.open有三个参数:url,windowname,otherfeatures。

For FF, if the second parameter (windowname) is not passed, it still works :)

对于FF,如果没有传递第二个参数(windowname),它仍然有效:)

But in IE 7,8 which we tested, we have to pass the second parameter

但是在我们测试的IE 7,8中,我们必须传递第二个参数

#7


1  

var newWin = window.open('', '', 'width=400, height=400, top=100, left=100');

In IE8 Use This first two arguments has to be blank then it works on IE8.

在IE8中使用前两个参数必须为空,然后才能在IE8上运行。

#8


0  

Can you check whether it throws any javascript error?

你能检查它是否会引发任何javascript错误吗?

You can use IE8 built in javascript debugger

你可以使用IE8内置的javascript调试器

#9


0  

The support article titled Q281679 by Microsoft was released for MSIE 5.5/6.0. But it could be applicable for MSIE 8.

微软的支持文章Q281679发布于MSIE 5.5 / 6.0。但它可能适用于MSIE 8。

Alternatively, you could use the X-UA-Compatible meta tag or header, and see if this can be resolved by resorting to the compatibility mode (I would personally use this as a last resort, and would instead attempt to write JavaScript that does not cause IE8 to behave as described).

或者,您可以使用X-UA兼容元标记或标头,并查看是否可以通过兼容模式解决这个问题(我个人会将此作为最后的手段使用,而是尝试编写不兼容的JavaScript导致IE8的行为如上所述)。

PS: To avoid IE8 from requiring the compatibility mode, use the services of the W3C page validator, and have the page tested in another standards compliant browser like Firefox 3 (don't forget to use Firebug and the Web Development Toolbar extensions if you use FF3).

PS:为避免IE8要求兼容模式,请使用W3C页面验证器的服务,并在另一个符合标准的浏览器(如Firefox 3)中测试页面(如果使用,请不要忘记使用Firebug和Web开发工具栏扩展FF3)。

#10


0  

If you use spaces or dashes in the window name, IE won't work (at least some versions that I used).

如果在窗口名称中使用空格或短划线,IE将无法工作(至少我使用的某些版本)。

#11


0  

IN IE if you open one window with window.open() - again if you want to open new window with window.open(),It will not open new window.

在IE中,如果你用window.open()打开一个窗口 - 再次如果你想用window.open()打开新窗口,它将不会打开新窗口。

For this the solutions is - IN Window.open parameters pass this parameter "copyhistory=no".

为此,解决方案是 - 在Window.open参数中传递此参数“copyhistory = no”。

e.g:

WindowName = window.open('','Name','height=320,width=428,toolbar=no, 
     menubar=no,scrollbars=no, resizable=no,location=no, directories=no,    
     status=no,copyhistory=no');

Hope this will be helpful for you.

希望这对你有所帮助。

#1


71  

IE8 doesn't like spaces in the window name.

IE8不喜欢窗口名称中的空格。

#2


4  

Removing the space from the window name solved the problem.

从窗口名称中删除空格解决了这个问题。

#3


4  

In IE8, the below function was not opening a new window pop up whereas it was working perfectly in Mozilla and Chrome.

在IE8中,下面的功能没有弹出一个新窗口,而是在Mozilla和Chrome中完美运行。

function openReports(reportUrl){
   window.open(reportUrl,'Report Information','height=800,width=1000,left=200,top=200,toolbars=no,resizable=no,scrollbars=auto,location=no');
}

Removing the space (Report Information)from the window name solved the problem for me too.

从窗口名称中删除空间(报告信息)也解决了我的问题。

#4


1  

This works for me:

这对我有用:

javascript:window.open('http://google.com', 'x'+'winName'+'x', 'location=0', 'status=0', 'toolbar=0', 'menubar=0', 'resizable=0', 'scrollbars=0', 'height=375', 'width=420');

#5


1  

I too had a problem with this issue. I had written a function like

我也遇到过这个问题。我写了一个像这样的函数

function newPopup(url) {
      popupWindow=window.open(url,'Detailed Informations','height=700,width=1000,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}

where there was a space in the window name i.e "Detailed Information" and due to this the popup was not working. Just dont put any spaces in the window name.

窗口名称中有空格,即“详细信息”,因此弹出窗口无法正常工作。只是不要在窗口名称中添加任何空格。

#6


1  

window.open has three parameters: url, windowname, otherfeatures.

window.open有三个参数:url,windowname,otherfeatures。

For FF, if the second parameter (windowname) is not passed, it still works :)

对于FF,如果没有传递第二个参数(windowname),它仍然有效:)

But in IE 7,8 which we tested, we have to pass the second parameter

但是在我们测试的IE 7,8中,我们必须传递第二个参数

#7


1  

var newWin = window.open('', '', 'width=400, height=400, top=100, left=100');

In IE8 Use This first two arguments has to be blank then it works on IE8.

在IE8中使用前两个参数必须为空,然后才能在IE8上运行。

#8


0  

Can you check whether it throws any javascript error?

你能检查它是否会引发任何javascript错误吗?

You can use IE8 built in javascript debugger

你可以使用IE8内置的javascript调试器

#9


0  

The support article titled Q281679 by Microsoft was released for MSIE 5.5/6.0. But it could be applicable for MSIE 8.

微软的支持文章Q281679发布于MSIE 5.5 / 6.0。但它可能适用于MSIE 8。

Alternatively, you could use the X-UA-Compatible meta tag or header, and see if this can be resolved by resorting to the compatibility mode (I would personally use this as a last resort, and would instead attempt to write JavaScript that does not cause IE8 to behave as described).

或者,您可以使用X-UA兼容元标记或标头,并查看是否可以通过兼容模式解决这个问题(我个人会将此作为最后的手段使用,而是尝试编写不兼容的JavaScript导致IE8的行为如上所述)。

PS: To avoid IE8 from requiring the compatibility mode, use the services of the W3C page validator, and have the page tested in another standards compliant browser like Firefox 3 (don't forget to use Firebug and the Web Development Toolbar extensions if you use FF3).

PS:为避免IE8要求兼容模式,请使用W3C页面验证器的服务,并在另一个符合标准的浏览器(如Firefox 3)中测试页面(如果使用,请不要忘记使用Firebug和Web开发工具栏扩展FF3)。

#10


0  

If you use spaces or dashes in the window name, IE won't work (at least some versions that I used).

如果在窗口名称中使用空格或短划线,IE将无法工作(至少我使用的某些版本)。

#11


0  

IN IE if you open one window with window.open() - again if you want to open new window with window.open(),It will not open new window.

在IE中,如果你用window.open()打开一个窗口 - 再次如果你想用window.open()打开新窗口,它将不会打开新窗口。

For this the solutions is - IN Window.open parameters pass this parameter "copyhistory=no".

为此,解决方案是 - 在Window.open参数中传递此参数“copyhistory = no”。

e.g:

WindowName = window.open('','Name','height=320,width=428,toolbar=no, 
     menubar=no,scrollbars=no, resizable=no,location=no, directories=no,    
     status=no,copyhistory=no');

Hope this will be helpful for you.

希望这对你有所帮助。