Window.open not working in IE8?

耗尽温柔 提交于 2019-12-31 17:51:02

问题


This is the JavaScript I'm currently using:

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?


回答1:


IE8 doesn't like spaces in the window name.




回答2:


Removing the space from the window name solved the problem.




回答3:


In IE8, the below function was not opening a new window pop up whereas it was working perfectly in Mozilla and 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:


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:


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:


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

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

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




回答7:


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.




回答8:


Can you check whether it throws any javascript error?

You can use IE8 built in javascript debugger




回答9:


The support article titled Q281679 by Microsoft was released for MSIE 5.5/6.0. But it could be applicable for 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).

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).




回答10:


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




回答11:


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.

For this the solutions is - IN Window.open parameters pass this parameter "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.



来源:https://stackoverflow.com/questions/1444677/window-open-not-working-in-ie8

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