Html 在 ASP.NET 的新选项卡中打开超链接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7795525/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Opening a hyperlink in a new tab in ASP.NET
提问by JaredH20
I have a hyperlink on my page and I would like it to automatically open in a new tab when clicked, how would I do this? If this is not possible I will accept new window.
我的页面上有一个超链接,我希望它在单击时自动在新选项卡中打开,我该怎么做?如果这是不可能的,我将接受新窗口。
回答by Curt
This depends on how the browser treats the target
attribute on the a
(anchor) tag
这取决于浏览器如何处理(anchor) 标签target
上的属性a
When target="_blank"
, older browsers, which don't have tabbing, will open a new window.
时target="_blank"
,没有选项卡的旧浏览器将打开一个新窗口。
Newer browsers, however, will use this to open a new tab.
但是,较新的浏览器将使用它来打开一个新选项卡。
回答by v01d
The syntax is following:
语法如下:
<a href="http://www.someurl.com" target="_blank">
This will open the page in new page or tab this depends on browser configuration.
这将在新页面或选项卡中打开页面,这取决于浏览器配置。
回答by Adnan Bhatti
add
添加
target="_blank" in your link.
If you want links on whole page to be open in new tab you can use.
如果您希望在新选项卡中打开整个页面上的链接,您可以使用。
<head>
<title></title>
<base target="_blank"/>
</head>
回答by canon
CSS3 offers a target-new property for which you can specify window | tab | none
:
CSS3 提供了一个target-new属性,您可以为其指定window | tab | none
:
If a user wanted to have new windows open in new tabs instead, she could use the following user style sheet to do so:
* { target-new: tab ! important }
如果用户想要在新选项卡中打开新窗口,她可以使用以下用户样式表来实现:
* { target-new: tab ! important }
回答by JOJO
Use the following
使用以下
<asp:HyperLink ID="hplStandard" runat="server" ForeColor="Green"
Font-Bold="True" Target="_blank">Standard Report</asp:HyperLink>
回答by samn
set the property Target to _blank
将属性 Target 设置为 _blank