Firefox 7 实现全屏浏览器窗口
我无法在 Firefox 7 中使用 javascript 调整浏览器窗口大小。到目前为止,此代码适用于我检查过的所有浏览器。有谁知道为什么它在 Firefox 7 中不起作用。
在我的示例中,我尝试调整由于单击父窗口中的链接而打开的窗口的大小。因此,我这里有2个文件。
index.html(父级)
头部部分
<script type="text/javascript">
function openwin() {
var win1 = window.open('index2.html','mywin','left=20,top=20,width=900,height=700,toolbar=1,resizable=0');
}
</script>
正文部分 -
<a href="javascript:openwin()">Click to open a new window</a>
index2.html(子)
头部部分
<script type="text/javascript">
function fullscreen() {
window.moveTo(0,0)
window.resizeTo(screen.availWidth, screen.availHeight);
}
</script>
身体部分 -
<a href="javascript:fullscreen()">Click to fullscreen a window</a>
如果有任何帮助,请告诉我。我认为FF7有一个错误。非常感谢
I am unable to resize a browser window using javascript in Firefox 7. This code works in all the browser so far I have checked. Does anyone know why it is not working in firefox 7.
In my example I am trying to resize a window which is opened as a result of clicking a link in a parent window. Thus, I have 2 files here.
index.html (parent)
Head section
<script type="text/javascript">
function openwin() {
var win1 = window.open('index2.html','mywin','left=20,top=20,width=900,height=700,toolbar=1,resizable=0');
}
</script>
Body section -
<a href="javascript:openwin()">Click to open a new window</a>
index2.html (child)
Head section
<script type="text/javascript">
function fullscreen() {
window.moveTo(0,0)
window.resizeTo(screen.availWidth, screen.availHeight);
}
</script>
Body section -
<a href="javascript:fullscreen()">Click to fullscreen a window</a>
Please let me know if any help. I assume there is a bug with FF7. Many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 FF6 中,您应该使用
window.innerWidth
或window.outerWidth
和window.innerHeight
或window.outerHeight
来设置窗口大小,如下所示:http://www.java2s.com/Code/JavaScript/Window-Browser /SettingWindowHeightandWidthFirefox.htm
In FF6 you should use
window.innerWidth
orwindow.outerWidth
andwindow.innerHeight
orwindow.outerHeight
to set window size, as shown here:http://www.java2s.com/Code/JavaScript/Window-Browser/SettingWindowHeightandWidthFirefox.htm
目前这是 Firefox 7 中的一个错误。已向 mozilla 报告。更多信息请参阅错误报告
This is currently a bug in Firefox 7. It have been already reported to mozilla. More info available in the Bug report