Firefox弹出窗口的Javascript调整大小? [英] Javascript resizing of Firefox pop-up window?

查看:172
本文介绍了Firefox弹出窗口的Javascript调整大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是学习Javascript和jQuery,但我是一个HTML'r试图采取下一步..

我试图删除内容放到一张桌子里,这个桌子可以是任何尺寸的(这是一个新闻网站)。我检查大小,然后相应地调整弹出窗口的大小。虽然窗口不是完全正确的工作,但在Firefox甚至没有调整大小。



使用通用链接弹出一个基本窗口:

$ p $ < a onclick =window.open('http://site.local/popup/','popup','width=1,height=1')> popup< / a>

我将它指向默认页面,cms将所有内容放入表格中= 顶部)。它有一个默认宽度=1来强制约束,然后让内容扩大表来设置实际大小。然后我检查表的大小,以查看和调整document.ready()的窗口大小:

 < script type =text / JavaScript的> 
<! -
$(document).ready(function(){
var divh = document.getElementById('top')。offsetHeight;
var divw = document .getElementById('top')。offsetWidth;

//测试大小
// alert(Table:width =+ divw +px / height =+ divh +px );

//调整大小
window.resizeTo(divw,divh);
}
- >
< / script>

我需要能够调整已经在Firefox中打开的窗口。



所有的窗口大小(Firefox除外)都关闭了,但是我可以填充它们 - 稍微大一点的比截止的要好,不幸的是,Firefox生成一个小小的180w x 249h的窗口,而且永远不会调整大小。 p>

我在这里搜索失败了 - 大多数人都建议在Firefox中编辑一个设置,这显然不能指望用户这样做。



有什么想法?

解决方案

Firefox为用户提供了允许/禁止使用J avascript。它是在工具 - 选项 - 内容 - 启用Javascript - > [高级]。

我不确定是否默认禁用大小调整,但是您可能需要检查你自己的Firefox安装第一。

如果它被默认禁用,那么不幸的是没有办法调整窗口的大小。一个丑陋的解决方法是使用 window.open()来重新打开自己,尽管使用了首选大小。


I'm just learning Javascript and jQuery, but I'm an HTML'r trying to take the next step..

I'm attempting to drop content into a table, which can be any size at all (It's for a news site). I check for size and then resize the popup accordingly; while the window isn't exactly right it works, but in Firefox it's not even resizing.

Using a generic link to pop-open a basic window:

<a onclick="window.open('http://site.local/popup/','popup','width=1,height=1')">popup</a> 

I'm pointing it to a default page where the cms is placing all content into a table (id="top"). It has a default width="1" to force a constraint, and then letting the content expand the table to set the real size. I then check the table size to see and resize the window on document.ready():

<script type="text/javascript">
 <!--
 $(document).ready(function() {
  var divh = document.getElementById('top').offsetHeight;
  var divw = document.getElementById('top').offsetWidth;

  //Test size
  //alert("Table: width= " + divw + "px / height= " + divh +"px");

  //Resize
  window.resizeTo(divw,divh);
  }    
 -->
</script>

I need to be able to resize a window already opened in Firefox.

All the window sizes (except Firefox) are off but I can pad them - a little larger is better than cut-off. Firefox, unfortunately, generates a tiny 180w x 249h window and never resizes.

I've searched here unsuccessfully - most suggest editing a setting in firefox, which I clearly can't expect users to do.

Any ideas?

解决方案

Firefox comes with a preference for user to allow/disallow resizing of window using Javascript. It's in Tools - Options - Content - Enable Javascript -> [Advanced].

I am not sure if resizing is disabled by default, but you might want to check your own Firefox installation first.

If it's disabled by default, then unfortunately there is nothing you could do to resize the window after it has been opened. An ugly workaround would be to open itself once again using window.open() with the preferred size though.

这篇关于Firefox弹出窗口的Javascript调整大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆