Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi Codians,
I have been in deep trouble for this tiny work[seems]. I have tried to run the window.open in google chrome and safari, but so far no luck. I have posted every where and posting here this is my last hope.
I am trying to do with the following code.

C#
string script= "window.open('http://www.codeproject.com','_blank','toolbar=yes,status=1,menubar=yes,scrollbars=yes,resizable=no,left=20,top=20,width=600,height=550');";

ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindowScript",  script, true);
Posted

1 solution

hi try this, hope this will help you.

put this script on your aspx page:
<script type="text/javascript">
function openNew() {
window.open('http://www.codeproject.com', 'mywindow', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=yes,resizable=no,width=600,height=550');
}
</script>

on code-behind:

Page.ClientScript.RegisterStartupScript(this.GetType(), "mywindow", "openNew();", true);
 
Share this answer
 
Comments
M.Hussain. 14-Mar-12 6:04am    
I have already tried this one, but no luck. Did you try it on safari and chrome?
tanweer 15-Mar-12 1:14am    
yes I tested it in Chrome and I am using Visual Studio 2010.(framwork 4)

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