Javascript 在firefox扩展的新选项卡中打开链接

Javascript 在firefox扩展的新选项卡中打开链接,javascript,firefox-addon,Javascript,Firefox Addon,我开发了一个webapp,将其用作Firefox扩展。在Firefox中,我将其包含在一个iframe中,如下所示 <iframe src="http://mywebapp.com" flex="2" id="browserTable" name="table_frame"/> 现在我想在我的应用程序中有一些传出链接。如果我只是使用普通的链接标记,比如 <a href="http://mywebapp.com/contact">Contact</a>

我开发了一个webapp,将其用作Firefox扩展。在Firefox中,我将其包含在一个iframe中,如下所示

<iframe src="http://mywebapp.com" flex="2" id="browserTable" name="table_frame"/>

现在我想在我的应用程序中有一些传出链接。如果我只是使用普通的链接标记,比如

<a href="http://mywebapp.com/contact">Contact</a>


链接在iframe中打开,因为它位于侧边栏中,所以空间较小。有没有办法在主浏览器窗口的新选项卡中打开它?

属性允许您指定在哪个窗口中打开链接。您可以在属性中放置以下特殊关键字:

    _blank - new window
    _self - same window (default)
    _parent - the window which opened the current window, or the parent frame in a frameset
    _top - overload the entire page, usually used in a frame context 
   "string" - in the window with an id of "string", or a new window if "string" is not the id of a current window
下面是您的HTML:

<a href="http://mywebapp.com/contact" target="_blank">Contact</a>
资料来源:


让我知道这是否可行。。。我自己也很好奇,但我目前的FF环境不是一个我可以轻松尝试扩展开发的环境,我不想改变尝试。

hm打开一个新的FF窗口,希望有一个选项卡,你认为这可能吗?也许css3:D会在一个新窗口检查这个??什么?不应该。这可能受到Firefox中客户端选项的影响,选中工具->选项,在“选项卡”选项卡上有一系列复选框。其中一个标题为“在选项卡中打开新窗口”。这是支票吗?如果没有,这就是它打开新窗口的原因。如果用户的客户端选项以这种方式配置,则无法“强制”用户打开选项卡。否则,目标属性应该打开一个新选项卡。如果我们可以集中打开的选项卡,那就太好了。最后一行应该这样做。我想不是。让我知道。。。我可以通读这些文件,试着找出如何做到这一点。再说一次,我出于自己的好奇心,而不是为了测试它。给我一只豚鼠!:)仅供参考
target=“\u content”
应在当前浏览器选项卡中打开侧栏链接。
var myUrl = "http://mesh.typepad.com";
var tBrowser = top.document.getElementById("content");
var tab = tBrowser.addTab(myUrl);
// use this line to focus the new tab, otherwise it will open in background
tBrowser.selectedTab = tab;