Can anybody suggest how we can open the page in new window using Response.Redirect in c#, I know we can do it using response.write as given below:
Response.Write("<script>");
Response.Write("window.open('"+url+"','_blank')");
Response.Write("</script>");
But what when javascript is disabled, the above code will not run.
Please suggest!!
As Tom Gullen suggested that is the only way.
I am assuming you’re using ASP.NET.
You can create a public function which receives the Url you want to open in the new windows.
This function then redirects to a page which does the dirty job.
This is Redirector.aspx
and the HTML of Redirector.asp
It’s not really really elegant code but it does the trick.
Obviously, if javascript is disabled it doesn’t work.
I’ve put together a sample here.
Hope it helps.