弹出窗口在 Firefox 中打开全屏,但尺寸已给出

发布于 2024-11-27 03:16:12 字数 471 浏览 0 评论 0原文

我正在打开一个弹出窗口,它会在 Internet Explorer 和 Mozilla Firefox 中打开。但 Firefox 会忽略给定的大小,因此会创建一个全屏弹出窗口。

以下代码:

<a href="agb.html" target="_blank" onclick="return popup(this.href);">linkname</a>

以下功能:

<script type="text/javascript">
function popup (url) {
fenster = window.open(url, "Popup", "width=640,height=700,resizable=yes,scrollbars=yes");
fenster.focus();
return false;
}
</script>

I'm opening a Popup, it opens in internet explorer and mozilla firefox. But firefox ignores the given sizes, so a fullscreen popup is created.

Following code:

<a href="agb.html" target="_blank" onclick="return popup(this.href);">linkname</a>

Following function:

<script type="text/javascript">
function popup (url) {
fenster = window.open(url, "Popup", "width=640,height=700,resizable=yes,scrollbars=yes");
fenster.focus();
return false;
}
</script>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

尴尬癌患者 2024-12-04 03:16:12

我在提交给弹出窗口的表单时遇到类似的问题。
我有

<form name ="printView" method ="post" action="printOnly.php" target="popUp"
             onsubmit="popup(this);" style="display:inline!important;"> 

(样式是使表单与另一个表单在同一行)

并且弹出功能是

function popup(form) {
    window.open('','formpopup', 'view text',
                'height=700,width=640,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=yes'
    );
    form.target = 'formpopup';
    view.focus(this);
}   

如您所见我已经尝试了顶部和左侧选项,但我的弹出窗口仍然以与主窗口相同的大小打开,并且滚动条、工具栏、菜单栏、目录和位置设置被忽略,无论我将它们的值设置为什么,我都只得到位置栏。
附言。我检查了 Firefox 弹出窗口首选项,它们都是允许的。

I'm having a similar problem with a form submitted to a popup.
I have

<form name ="printView" method ="post" action="printOnly.php" target="popUp"
             onsubmit="popup(this);" style="display:inline!important;"> 

(the style is to get the form on the same line as another form)

And the popup function is

function popup(form) {
    window.open('','formpopup', 'view text',
                'height=700,width=640,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=yes'
    );
    form.target = 'formpopup';
    view.focus(this);
}   

As you can see I have tried the top and left options, but my popup still opens at the same size as the main window, and the scrollbar, toolbar, menubar, directories and location settings are disregarded, I get only the location bar no matter what I set their values to.
PS. I checked Firefox popup preferences and they are all allowed.

风轻花落早 2024-12-04 03:16:12

这是我在一个开发网站上的内容,我知道它可以在 Firefox 中运行(实际上这是我测试过的唯一东西。
我对 js 不太了解,所以我确信我是从网络上的某个地方得到这个的——所以希望它遵循正确的做法,而不是遵循正确的做法。

// js:
<script type="text/javascript">
// Popup window code
function newPopup(url) {
    popupWindow = window.open(
url,'popUpWindow','height=390,width=350,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=yes')
}

</script>

// link: edit: an onclick event should be used instead, but I'm leaving my original code.
<a href="Javascript:newPopup('/url/');">Link text</a>

This is what I have on a dev site which I know at works in Firefox (actually it's the only thing I have tested it on.
I don't know too much about js, so I'm sure I got this from the web somewhere- so hopefully it follows correct practices and what not.

// js:
<script type="text/javascript">
// Popup window code
function newPopup(url) {
    popupWindow = window.open(
url,'popUpWindow','height=390,width=350,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=yes')
}

</script>

// link: edit: an onclick event should be used instead, but I'm leaving my original code.
<a href="Javascript:newPopup('/url/');">Link text</a>
注定孤独终老 2024-12-04 03:16:12

您需要将弹出窗口的显示属性设置为 display: block;display: inline-block 以使宽度和高度尺寸生效。

You need to make the display property of your popup to be either display: block; or display: inline-block for your width and height dimensions to take effect.

我不在是我 2024-12-04 03:16:12
<a href="agb.html" target="_blank" onclick="popup(this.href);return false;">linkname</a>

会做你想做的事;)

<a href="agb.html" target="_blank" onclick="popup(this.href);return false;">linkname</a>

will do what you want ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文