2011-02-24 85 views
3

我开发了一个web应用程序以将其用作Firefox扩展。在Firefox中,我把它包含在这样一个iframe中在firefox-extension的新选项卡中打开链接

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

现在我想在我的应用程序中有一些传出链接。如果我只是用正常的链路上的标记像

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

该链接在小空间中,因为它是在侧边栏的iframe打开。有什么方法可以在主浏览器窗口的新选项卡中打开它吗?

回答

7

target属性允许您指定要打开你有这些特殊关键字的链接,你可以在属性放在哪个窗口:

_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> 

编辑做了一些研究我们的意见讨论后,发现这个片段:

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; 

来源:http://mesh.typepad.com/blog/2004/11/creating_a_new_.html

让我知道你的作品了......好奇自己,但我目前的FF环境不是一个中,我可以很容易地扩展开发实验,我不想改变要尝试的事情。

+0

hm打开一个新的ff窗口,想要制表符,你认为这是可能的吗?也许与css3:D http://www.w3.org/TR/2004/WD-css3-hyperlinks-20040224/会检查出 – 2011-02-24 20:49:48

+0

一个新窗口??世界卫生大会?不应该是。这可能会受到Firefox中客户端选项的影响,请检查工具 - >选项,在“选项卡”选项卡上有一系列复选框。其中一个标题为“在标签中打开新窗口”。这是否被检查?如果没有,那就是为什么它打开一个新窗口。如果客户端选项以这种方式配置,则无法“强制”用户打开选项卡。否则,目标属性应该打开一个新标签。 – 2011-02-24 21:12:23

+0

这是检查... – 2011-02-24 22:04:04

相关问题