To help protect your security, your web browser has restricted this file from showing active content that could access your computer. Click here for options...
WPF+WEBBROWSER 读取本地文件时,会弹出上面这个框,需要人工点一下,才可以正常运行.
网上找了一下方法.http://www.cnblogs.com/sshoub/archive/2012/07/20/2601414.html 但发现不实用.
<Grid>
<WebBrowser x:Name="WebBrowser1" Source="file://127.0.0.1/c$/dashboard1.swf"></WebBrowser>
</Grid>
C$ 这个应该是共享吧。在实际运行中不适用。
找个了变通的方法,将相应的资源文件设为 : 生成操作->resource
调用代码改成:
Uri uri = new Uri(@"pack://application:,,,/maps/map.htm");
Stream source = Application.GetResourceStream(uri).Stream;
WBaidu.NavigateToStream(source);
此时运行,发觉没有警告框了.