通过 JavaScript 打开新窗口时,浏览器会忽略窗口参数吗?

发布于 2024-09-25 21:55:28 字数 306 浏览 2 评论 0 原文

我正在通过 javascript 打开一个弹出窗口。我正在尝试设置一些显示参数 - 特别是我们想隐藏位置和状态栏,但我测试过的每个浏览器,位置和状态栏仍然显示。

我的代码如下所示:

newwindow=window.open(url,'name','height=250,width=290,left=200,top=200,location=no,resizable=yes,scrollbars=yes,toolbar=no,status=no');

有什么想法吗?客户端坚持使用弹出窗口,而不是悬停工具提示。

I'm opening a popup window via javascript. I'm trying to set some of the display parameters - specifically we want to hide the location and statusbar, but every browser I've tested this in, the location and status bars still display.

My code looks like this:

newwindow=window.open(url,'name','height=250,width=290,left=200,top=200,location=no,resizable=yes,scrollbars=yes,toolbar=no,status=no');

Any ideas? The client is insisting on a popup window, rather than a hover tooltip.

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

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

发布评论

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

评论(5

寂寞陪衬 2024-10-02 21:55:29

出于安全原因,浏览器已停止监听某些参数。例如,FF3+ 和 IE6 / 7+ 强制设置位置栏,以防止诈骗者冒充其他网站。

相关:Internet Explorer 7 安全状态栏

每当您访问任何网站时,您都应该查看该网站的完整地址 (URL),以了解您正在查看的网站。 IE7 通过在每个窗口中强制显示地址栏来帮助您,但您仍然可能需要滚动它或最大化窗口才能查看完整地址。

如果您需要更多的自由,并且碰巧对用户的计算机有一定的控制权(例如在封闭的内部网中),可以使用诸如Mozilla Prism 允许网站看起来更像桌面应用程序。但这些都是高度专业化的解决方案,不适合普通网站。

The browsers have stopped listening to some of the parameters for security reasons. For example, FF3+ and IE6 / 7+ force a location bar to prevent scammers pretending to be a site they're not.

Related: The Internet Explorer 7 Security Status Bar

Whenever you are visiting any website, you should look at the full address (URL) for the site to understand what website you are looking at. IE7 helps you by enforcing the presence of an address bar in every window, but you still may need to scroll through it or maximize the window in order to view the full address.

If you need more freedom, and happen to have some control over the user's computer (e.g. in a closed intranet), there are solutions like Mozilla Prism that allow a web site to appear rather like a desktop application. But those are highly specialized solutions unsuitable for normal web sites.

孤凫 2024-10-02 21:55:29

是的,某些参数被禁用。原因是应该不可能打开一个伪装成其他东西的窗口。

确切的规则取决于浏览器、页面范围(内联网/公共)和用户设置。大多数浏览器不会删除地址栏,以便您始终可以看到页面来自哪里。

例如,您可以在此处阅读有关 Internet 限制的信息资源管理器

一些引言:

“适用于 Windows XP 的 Internet Explorer 6
SP2 要求窗口标题
栏和状态栏始终位于
显示器的可见区域;如果
地址栏显示,它还必须
保持可见。通过放置这些
对脚本打开窗口的限制,
窗口限制安全
功能可防止恶意代码
隐藏信息并防止欺骗
用户界面。窗户
限制功能默认开启
对于互联网区域,以及功能
本地默认关闭
Intranet 和可信站点区域。”

以及:

“状态栏是一个互联网
浏览器安全功能
为用户提供互联网
资源管理器安全区域信息。
Internet Explorer 6 之前的版本
Windows XP SP2,状态栏可以
通过脚本对用户隐藏
调用 window.open 方法。和
状态栏从视图中隐藏,用户
可能会被欺骗而认为
当他们访问一个受信任的网站时
实际上正在与一个交互
恶意主机。

由于窗口限制,
状态栏无法关闭
由 window.open 创建的任何窗口
方法;它始终对所有人可见
Internet Explorer 窗口。该区
状态栏的信息
包含不能被欺骗或隐藏
从视图中,以便用户始终
知道在哪个安全区
正在显示内容。”

这是关于 IE 6 的,因为它是在那个时候引入的。IE 7 中还有一些进一步的变化,但这主要与导航的变化有关,使 open< 的一些参数/code> 命令的工作方式不同或已过时。

Yes, some parameters are disabled. The reason is that it should not be possible to open a window that pretends to be something else.

The exact rules depends on the browser, the scope of the page (intranet/public), and the user settings. Most browsers won't remove the address bar, so that you can always see where the page is coming from.

You can for example read here about the restrictions in Internet Explorer.

Some quotes:

"Internet Explorer 6 for Windows XP
SP2 requires that the window title
bar and status bar are always in the
visible area of the display; if the
address bar is displayed, it must also
remain visible. By placing these
restrictions on script-opened windows,
the Window Restrictions security
feature prevents malicious code from
hiding information and from spoofing
user interfaces. The Window
restrictions feature is on by default
for the Internet zone, and the feature
is off by default for the Local
Intranet and Trusted Sites zones."

and:

"The status bar is an Internet
Explorer security feature that
provides the user with Internet
Explorer security zone information.
Prior to Internet Explorer 6 for
Windows XP SP2, the status bar could
be hidden from the user by scripts
that call the window.open method. With
the status bar hidden from view, users
could be deceived into thinking that
they were on a trusted site when they
were actually interacting with a
malicious host.

With window restrictions in place, the
status bar cannot be turned off for
any window created by the window.open
method; it is always visible for all
Internet Explorer windows. The zone
information that the status bar
contains cannot be spoofed or hidden
from view, so that the user always
knows in what security zone the
content is being displayed."

This is about IE 6, as that's when this was introduced. There were some furhter changes in IE 7, but that mostly has to do with how the navigation changed, making some parameters of the open command work differently or being obsolete.

戏剧牡丹亭 2024-10-02 21:55:29

由于安全模型的变化,不可能再有完全无镶边的弹出窗口,并且剥离所有镶边的尝试将被忽略。您是否考虑过使用 JQuery 创建一个外观像窗口的伪弹出窗口,为其提供拖动处理程序和关闭按钮?您可以优雅地降级为标准弹出窗口。

http://jqueryui.com/demos/draggable/

Due to changes in security models, it's not possible to have a totally chromeless popup window any more and attempts to strip all the chrome off will simply be ignored. Have you considered using JQuery to create a pseudo-popup that is skinned to look like a window, give it drag handlers and a dismiss button? you could gracefully degrade to a standard pop-up.

http://jqueryui.com/demos/draggable/

俯瞰星空 2024-10-02 21:55:29

大多数浏览器默认显示位置栏和状态栏,并且也无法覆盖 window.status。这样做是为了安全(防止网络钓鱼)。

Most browsers displays the location bar and status bar by default, and make it also impossible to override window.status. This is done for safety (to guard against phishing).

我也只是我 2024-10-02 21:55:29

有关用户如何更改允许 Javascript 将状态和/或地址设置为隐藏或可见的设置的一些更具体的信息:

从 IE 安全选项卡的“自定义级别”对话框 - 向下滚动到:

“允许网站打开没有地址或状态栏的窗口”

根据这些是否设置为“禁用”或“启用” - 您将看到应用程序的不同行为。

据我所知,这适用于 IE7、IE8 和 IE9

Some more specific information on how a user can change the setting that allows the status and/or address to be set by Javascript to hidden or visible:

From the 'custom level' dialog from the IE security tab - scroll down to:

"Allow websites to open windows without address or status bars"

Depending on if these is set to Disable or Enable - you will see different behavior from your application.

To my knowledge this applies to IE7, IE8, and IE9

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