JaredH20
JaredH20

Reputation: 368

Opening a hyperlink in a new tab in ASP.NET

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.

Upvotes: 16

Views: 48216

Answers (6)

JOJO
JOJO

Reputation: 316

Use the following

<asp:HyperLink ID="hplStandard" runat="server"  ForeColor="Green"  
 Font-Bold="True" Target="_blank">Standard Report</asp:HyperLink>

Upvotes: 3

canon
canon

Reputation: 41715

CSS3 offers a target-new property for which you can specify 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 }

Upvotes: 3

v01d
v01d

Reputation: 1507

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.

Upvotes: 14

Adnan Bhatti
Adnan Bhatti

Reputation: 3490

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>

Upvotes: 5

samn
samn

Reputation: 2817

set the property Target to _blank

Upvotes: 2

Curtis
Curtis

Reputation: 103428

This depends on how the browser treats the target attribute on the a (anchor) tag

When target="_blank", older browsers, which don't have tabbing, will open a new window.

Newer browsers, however, will use this to open a new tab.

Upvotes: 34

Related Questions