这是一个动态加载WebBrowser内容的代码
如果客户端安装的是ie6的话 正常显示
如果安装的是ie7的话 则无法显示 //通过传递进来的绝对路径进行SVG的显示
//这个一个内嵌网页浏览器
webBrowser1.DocumentText = @"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" + "\n" +
"<html>\n" +
"<head>\n" +
"<title></title>\n" +
@"<script type=""text/javascript"">" + "\n" +
"window.onload = function()\n" +
"{\n" +
"writeSwfDiv()\n" +
"}\n" +
"function writeSwfDiv()\n" +
"{\n" + "" + "\n" +
"var _div = document.getElementById('divSVG')\n" +
@"_div.innerHTML='<embed id=""svg"" src="""+ strChangeSvgPath +@""" autostart=""true"" width=""507px"" height=""460px"">'" + "\n" +
"}" + "\n" +
"</script>\n" +
"</head>\n" +
"<body>\n" +
@"<div id=""divSVG"" style="" width:507px;height:460px;margin:2px; border-right: #339966 2px solid; border-top: #339966 2px solid; border-left: #339966 2px solid; border-bottom: #339966 2px solid;"">" + "\n" +
"</div>\n" +
"</body>\n" +
"</html>\n";
如果客户端安装的是ie6的话 正常显示
如果安装的是ie7的话 则无法显示 //通过传递进来的绝对路径进行SVG的显示
//这个一个内嵌网页浏览器
webBrowser1.DocumentText = @"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" + "\n" +
"<html>\n" +
"<head>\n" +
"<title></title>\n" +
@"<script type=""text/javascript"">" + "\n" +
"window.onload = function()\n" +
"{\n" +
"writeSwfDiv()\n" +
"}\n" +
"function writeSwfDiv()\n" +
"{\n" + "" + "\n" +
"var _div = document.getElementById('divSVG')\n" +
@"_div.innerHTML='<embed id=""svg"" src="""+ strChangeSvgPath +@""" autostart=""true"" width=""507px"" height=""460px"">'" + "\n" +
"}" + "\n" +
"</script>\n" +
"</head>\n" +
"<body>\n" +
@"<div id=""divSVG"" style="" width:507px;height:460px;margin:2px; border-right: #339966 2px solid; border-top: #339966 2px solid; border-left: #339966 2px solid; border-bottom: #339966 2px solid;"">" + "\n" +
"</div>\n" +
"</body>\n" +
"</html>\n";
这样内容的文件在IE7里面本身就不能显示?如果可以显示的话,生成一个htm文件,再加载呢?
第二:
为什么不用url或者navigat
是因为用navigate需要html的绝对地址 而在.net里面我不知道怎么写这个在应用程序内部文件的绝对地址就算可以左第二点 也不一定能显示这个WebBrowser
我确实有这个问题
1,不能使用文件路径,是ie7安全性原因
2,iis要注册svg扩展,也就是http://xx.svg能够显示。例如 string strChangeSvgPath = "http://localhost/test.svg";
1,不能使用文件路径,是ie7安全性原因
2,iis要注册svg扩展,也就是http://xx.svg能够显示。
========
直接打开svg是可以显示的那个不能使用文件路径
是什么意思?
是不能加file:///吗?
我没加
我的是
src="D:\\hh3.svg"
string strChangeSvgPath = @"http://localhost/test.svg";
下面方法不行
string strChangeSvgPath = @"C:\\Inetpub\\wwwroot\\test.svg";
用string strChangeSvgPath = @"http://localhost/test.svg";是可以显示
我的svg是从客户端读取进来然后显示的那么每次读取都只能把svg文件拷到C:\\Inetpub\\wwwroot\\test.svg显示
用完然后删除吗?
谢谢
不过SVG估计是不能改的了
而且也只能用WebBrowser
]
所以恐怕只有每此读入的时候
拷贝到wwwroot
然后退出时候删除没办法
哎