访问浏览器中其他选项卡的内容 [英] Accessing the content of other tabs in browser

查看:133
本文介绍了访问浏览器中其他选项卡的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Mozilla Firefox,并试图找出一种方法来访问使用JavaScript和DOM的同一窗口中的其他选项卡的内容(如果存在,我向其他技术开放)。



例如我想在 tab1 中运行JavaScript,一些其他标签。基本上我需要这个,所以我可以识别一个标签,因为在当前页面打开 href 而不使用 window.open 方法。我想要的只是一个简单的超级链接,它打开属于与当前页面相同的域的页面(页面应该在新标签中打开)。现在我希望能够从当前选项卡访问这个新选项卡。

解决方案

您可以使用 HTML5跨窗口消息传递功能 ...但这还是有点前沿的。



即使在这种情况下,您可能需要使用javascript劫持标记click事件,并自行打开窗口,以便您可以访问新的窗口对象消息。

I am using Mozilla Firefox and I am trying to figure out a way to access the content of other tabs in the same window using JavaScript and DOM (I am open to other techniques if exist).

E.g. I want to run a JavaScript in tab1 which can find the title of some other tab. Basically I need this so that I can identify a tab which has opened due an href in my current page without using window.open method. All I want is a simple hyper link which opens a page belonging to the same domain as the current page (the page should be opened in a new tab). Now I want to be able to access this new tab from the current tab.

解决方案

You could use HTML5 cross-window messaging...but that's kinda cutting edge.

Even in that case you'd probably need to hijack the tag 'click' event with javascript and open the window yourself so that you'd have access to the new window object for posting messages.

这篇关于访问浏览器中其他选项卡的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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