yash yash - 2 months ago 19x
ASP.NET (C#) Question

How to open a link in new tab using javascript

I am working on a website, in which I have to open a url from backend. I am using c# now. My problem is that I want to open link in new tab instead of new window.

My code is here:-

string url = ppHref.ToString();

string newScript = "<script language='javascript'>window.open('" + ppHref.ToString() + "', '_blank');</script>";

ClientScript.RegisterStartupScript(this.GetType(),"OpenUrl", newScript);

Can Anybody tell me how to open this url in new tab. I don't like pop ups so I don't wanna use
. Please help me.

Thanks in Advance

<a href="javascript:" onclick="window.open('https://www.google.co.in');" target="_blank">Sample Code</a>