Home
Manage Your Code
Snippet: Open a new browser window at client (from C# server side) (C#)
Title: Open a new browser window at client (from C# server side) Language: C#
Description: C# code that pops a new brower open at the client end using javascript Views: 235
Author: Als James Date Added: 11/11/2008
Copy Code  
1String file = Server.MapPath("file.html");
2
3String script = String.Format("<script language='javascript'>window.open (\"{0}\",\"{1}\",\"status=1,resizable=1,scrollbars=1,toolbar=1\");" +
4       "<" + "/script>", file, DateTime.Now.ToFileTimeUtc());
5
6Page.ClientScript.RegisterStartupScript(this.GetType(), "script", script);
Notes
(DateTime is the unique window name so more than one can open)