使用 window.open() 时的最佳实践

发布于 2024-10-03 02:52:17 字数 295 浏览 0 评论 0原文

我正在开发一个网络应用程序,其中某些链接可以使用最少的浏览器镶边打开新窗口。用户很可能希望在屏幕上并排或平铺显示它们。 (想想文本编辑器、文件系统导航或终端窗口。)我知道这在当时是常见的做法,但我想知道现在选项卡如此常见并且网络的一般工作模型已经发生了一些变化,情况是否发生了变化。

  • 是否有任何支持或反对打开新窗口的建议?
  • 我应该注意哪些浏览器不兼容的情况?
  • 窗口上有什么我不应该通过 JavaScript 修改的内容吗? EG:窗户尺寸、去除某些镀铬元素等。
  • 还有什么想到的吗?

I'm working on a web-app where it would be useful for some links to open new windows with minimal browser chrome. It's very likely that the user will want to display them side-by-side or tiled on-screen. (Think text-editors, filesystem navigation or terminal windows.) I know this was common practice back in the day, but I'm wondering if things have changed now that tabs are so common and the web's general working model has changed a bit.

  • Are there any recommendations for or against opening new windows?
  • Are there any browser incompatibilities that I should be aware of?
  • Is there anything on the window that I should not modify via javascript? E.G.: window size, removal of certain chrome elements, etc.
  • Anything else that comes to mind?

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

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

发布评论

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

评论(1

你是年少的欢喜 2024-10-10 02:52:17

我知道这是当时的常见做法

实际上,随着网络应用程序开始接管传统桌面应用程序的角色,我看到这种情况又回来了。

是否有任何支持或反对打开新窗口的建议?

只要您将它们用于正确的目的,就应该没问题。永远不要让用户感到惊讶/意外地打开窗口。

是否存在我应该注意的浏览器不兼容性?

并非所有浏览器都会尊重您请求的所有窗口功能。例如,即使您要求 Firefox 不显示地址栏,Firefox 也会始终显示地址栏。

窗口上有什么东西是我不应该通过 JavaScript 修改的吗? EG:窗口大小、删除某些镀铬元素等。

请参阅前两个答案。

I know this was common practice back in the day

Actually I see this coming back as web-apps start taking over the roles of traditional desktop apps.

Are there any recommendations for or against opening new windows?

As long as you use them for the right purpose, you should be fine. Never surprise the user / open windows unexpectedly.

Are there any browser incompatibilities that I should be aware of?

Not all browsers will respect all the window features you request. For example, Firefox will always show the address bar even if you ask it not to.

Is there anything on the window that I should not modify via javascript? E.G.: window size, removal of certain chrome elements, etc.

See previous two answers.

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