Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
How to open the page in new window by using the only html code.I have written the code like this
XML
<A style="COLOR: #000080; TEXT-DECORATION: underline" href="/A/B/web/images/abc.pdf" target=_blank>ABC</A>


But its opening the page in new tab.I dont want like that.The page has to open in new window.Can anyone help regarding this?
Posted
Comments
rahkan 3-Jan-13 11:31am    
If I remember correctly that is a browser setting, whether it opens in a tab or a new window will depend on how the users have their browser configured
priya9826 3-Jan-13 11:32am    
How to configure the browser to open the page in new window?
rahkan 3-Jan-13 12:10pm    
depends on what browser you're using, but it should be under options somewhere
priya9826 3-Jan-13 12:51pm    
Sorry..I am using IE9
priya9826 3-Jan-13 12:52pm    
Sorry.I am using IE9

As far as I know there is no way to do this using "target" property.

you may have to use following way

HTML
<script type="text/javascript">
	function pop_up(hlink, wname)
	{
		if (! window.focus)
			return true;
		var href;
		if (typeof(hlink) == 'string')
			href=hlink;
		else
			href=hlink.href;
		window.open(
			href,
			wname,
			'width=400,height=200,toolbar=no, scrollbars=yes'
		);
		return false;
	}
	</script>
	<a style="COLOR: #000080; TEXT-DECORATION: underline" href="/A/B/web/images/abc.pdf" onclick="return popup(this, 'color pop up')">ABC</a></script>
 
Share this answer
 
Comments
priya9826 3-Jan-13 12:48pm    
T3
The above piece of code opens the page in new window in another project.If I copy the same code in to my application.It doesnt works for me.Do I need to add anything for this?
Tharaka MTR 3-Jan-13 13:47pm    
no you no need to add anything for this.
Use Javascript. window.open("url") will help to open new window. But sometimes browser will not allow to open pop up windows for stop advertisements via pop up windows,
 
Share this answer
 

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



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