Reputation: 31
I need to open HTML page from my aspx page using following javascript, but it's showing blank page in chrome and firefox and nothing happen in IE9.
ClientScript.RegisterStartupScript(this.GetType(), "openWindow",
"<script language='javascript' type='text/javascript'>showModalDialog('C:/Users/Administrator/Desktop/test.html');</script>");
Upvotes: 0
Views: 1501
Reputation: 623
you can try this
string strScript = "window.open('C:/Users/Administrator/Desktop/test.html');";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), strScript, true);
Upvotes: 0
Reputation: 66641
You try to open a file on the client computer
C:/Users/Administrator/Desktop/test.html
you must distinguish the code that run on server and the code that run on client.
When you make an html page, a web page, your files and connections must get from the server using http://
protocol. Its impossible to read a file that way from the server, its also impossible to give command to the client to read a file from his computer.
Upvotes: 1