Introduction


Here I will explain how to open all hyperlinks in new window using Jquery in asp.net.
Description:
  
In previous article I explained
expand textbox on focus and disable right click on image using JQuery and many articles relating to JQuery. Now I will explain how to open all hyperlinks in new window using JQuery in asp.net.

To implement this concept we need to write code as shown below
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>JQuery open all hyperlinks in new window</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$('a').click(function() {
window.open($(this).prop('href'), '', 'height=600,width=700');
return false;
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>

<a href="http://www.google.com">Google</a><br />
<a href="http://www.bing.com">Bing</a><br />
</div>
</form>
</body>
</html>
If you observe above code in header section I written code to open new window whenever click on new link on webpage.

Comments ( 0 )