Subscribe For Free Updates!

We'll not spam mate! We promise.

Aug 27, 2012

ASP.Net Tutorials:Open External Link in New Window Using JQuery


Open all Link in New Window Using JQuery in
To day I will explain you how to open all external links in new window using JQuery in

In Prevision Article i explained you how to Show Alert Box Through JQuery in when user is idle or inactive.

If we don't open the external links on our website in a New Window, we can loose all our visitor or viewers. So It is important always to open All External link in New Window or Tab as for most websites views are everything.

So  Lets Start!! Firstly Create a Project in Asp.Net in Visual Studio.
and Write the Following Code.
<html xmlns="">
<head id="Head1" runat="server">
<title>JQuery open all hyperlinks in new window</title>
<script type="text/javascript" src="">
<script type="text/javascript">
$undefineddocument).readyundefinedfunctionundefined) {
$undefined"a[href^='http:']:notundefined[href*='" + + "'])").clickundefinedfunctionundefined) {
window.openundefined$undefinedthis).propundefined'href'), '', 'height=600,width=700');
return false
<form id="form1" runat="server">
<a href="">Aspdotnet-Suresh</a><br />
<a href="">Google</a><br />
<a href="">Bing</a><br />

 If you observe the above code, in the header section I have written code in jquery to exclusively open external links in a new window and internal links in the same window.

Sample Out Put

Open all Link in New Window Using JQuery in

DOWNLOAD Source Code

Plese Feel Free to Socializer This Post


  1. If you need your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (no matter why you broke up) you have to watch this video
    right away...

    (VIDEO) Want your ex CRAWLING back to you...?


Become a Fan

visual studio learn