Javascript 在单个浏览器中打开多个选项卡
有谁知道如何在一个浏览器中打开多个 URL。 我希望在 IE 的选项卡中打开 URL,而不是打开多个窗口。 我正在尝试使用 JavaScript 来解决这个问题。
Does anyone know how to open multiple URL's in a single browser.
Instead of opening multiple windows, I want the urls to open in tabs in IE.
I am trying to approach this using JavaScript.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这严格来说是浏览器中的用户首选项,切勿尝试覆盖它。
This strictly is a user preference in the browser and never try to override that.
对于实际的浏览器选项卡,您唯一可以做的就是向链接添加
target="_blank"
属性。这可能会打开选项卡,但也可能会打开窗口。正如 phoenix 所说,这是用户的偏好。 (顺便说一句,Firefox、Chrome 和 Opera 默认情况下都会在选项卡中打开“空白”目标。)另一种解决方案是在页面本身内使用 Javascript 选项卡。如果您使用 jQuery,这篇文章中提到了一些插件只需阅读。否则,请在谷歌上搜索一下纯 JS 解决方案。
For actual browser tabs, the only thing you can do is add the
target="_blank"
attribute to links. This may open tabs, but it may open windows instead. It's a user preference, like phoenix said. (By the way, Firefox, Chrome and Opera all opens "blank" targets in tabs by default.)The other solution is to use Javascript tabs within the page itself. If you use jQuery, there are some plugins mentioned on this article I just read. Otherwise, do a bit of Googling for pure JS solutions.
如果只有 Internet Explorer 呢?
另外,Greg 最初的问题是关于 JavaScript,但是否可以制作一个简单的 ActiveX/.NET 对象来执行此操作,并且可以从 JavaScript 调用并将 URL 作为参数传递?
What about if it's Internet Explorer only?
Also, Greg's original question was about JavaScript but would it be possible to make a simple ActiveX/.NET object that could do this and you could call from JavaScript and pass URL as a parameter?
您可以说“永远不要尝试覆盖它”,但如果用户处于浏览器处于管理员控制之下的封闭环境中,那么用户别无选择。浏览器的用途远不止网络。公司网站上的浏览器不属于用户,而是属于公司。
You can say "never try to override that" but if the user is in a closed environment in which the browser us under control of the administrator, then the user has no choice. Browsers are used for much more than the web. A browser on a corporate site does not belong to the user, it belongs to the corporation.