[英]Open static HTML file from asp.net
我需要使用以下JavaScript从aspx页面打开HTML页面,但它在chrome和firefox中显示空白页面,而IE9中什么也没有发生。
ClientScript.RegisterStartupScript(this.GetType(), "openWindow",
"<script language='javascript' type='text/javascript'>showModalDialog('C:/Users/Administrator/Desktop/test.html');</script>");
您尝试在客户端计算机上打开文件
C:/Users/Administrator/Desktop/test.html
您必须区分在服务器上运行的代码和在客户端上运行的代码。
制作html页面,网页时,您的文件和连接必须使用http://
协议从服务器获取。 这样就无法从服务器读取文件,也无法向客户端发出命令从其计算机读取文件的命令。
你可以试试这个
string strScript = "window.open('C:/Users/Administrator/Desktop/test.html');";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), strScript, true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.