Click here to Skip to main content
15,896,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

When we keep target="_blank" for a tag the new window will open in new tab and it is directly visible to us. My requirement is to open new window but the main window should be first visible, not the new window. Wat to do can anybody help??

Thanks...
Posted
Updated 19-Jul-12 23:43pm
v2

1 solution

Hi Venkat,

Do it like this using javascript:

XML
<html>
<head>
<script type="text/javascript" language="javascript">

function OpenURL(url)
{
var newwindow=window.open(url);
window.focus();
}

</script>
</head>
<body>

<a href="javascript:OpenURL('http://www.google.com');"> Go Google </a>

</body>
</html>


Accept this as answer if it helps you. Good Luck!

Happy Coding :)
 
Share this answer
 
v2
Comments
Venkat_C6 20-Jul-12 6:25am    
Hi Sunny thanks for ur reply.. But with this also im not getting. It also showing the new tab opened but not the current tab page.
Sunny_Kumar_ 20-Jul-12 6:47am    
share the code that you've tried so far to achieve this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900