Jam*_*son 8 javascript google-chrome popup window.open
我正在使用javascript的window.open打开用户点击指定宽度和高度(760x581)的浏览器窗口,这在Internet Explorer,Safari和Firefox上正常工作,但Google Chrome给了我一些问题.在其他浏览器中,高度被正确地用作内容的高度,但在谷歌浏览器中,它使实际的浏览器窗口高581像素而不是内容.有没有办法来解决这个问题?
<a href="http://domain.com/example.php" onclick="window.open('http://domain.com/example.php', '', 'width=760, height=581, top=15, left=15, toolbar=0, menubar=0, scrollbars=1, resizable=1, copyhistory=0, location=0, directories=0, status=1, titlebar=1, personalbar=0');return false">click here</a>
Run Code Online (Sandbox Code Playgroud)
所以我把事情弄乱了,发现一些浏览器支持该属性,innerHeight并且window.open以下内容在所有浏览器中按预期工作,所需的内容高度为 775px,仅在 Chrome 中添加了 50px:
window.open($(this).attr('href'), 'videoplayer',
'width=1242, height=775, innerHeight=825, location=no, menubar=no, status=no, titlebar=no, scrollbars=no'
);
Run Code Online (Sandbox Code Playgroud)
我在 Chrome 6.0.472.63、Firefox 3.6、3 和 2、IE 8 和 7 以及 Opera 10.62 中对此进行了测试。当我只使用heightChrome 时,大约 50px 太短并且有滚动条,但上面的所有浏览器都很好。添加的innerHeight属性设置为比我希望的多 50px,它可以在 Chrome 以及所有其他浏览器中运行。
更新:看起来这会在 Safari 中产生一个问题,增加 50px 的高度。将研究解决该问题的方法。
| 归档时间: |
|
| 查看次数: |
9262 次 |
| 最近记录: |