WPF+WEBBROWSER對本地檔案彈出警告框的處理
阿新 • • 發佈:2019-02-08
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 讀取本地檔案時,會彈出上面這個框,需要人工點一下,才可以正常執行.
<Grid>
<WebBrowser x:Name="WebBrowser1" Source="file://127.0.0.1/c$/dashboard1.swf"
</Grid>
C$ 這個應該是共享吧。在實際執行中不適用。
找個了變通的方法,將相應的資原始檔設為 : 生成操作->resource
呼叫程式碼改成:
Uri uri = new Uri(@"pack://application:,,,/maps/map.htm");
Stream source = Application.GetResourceStream(uri).Stream;
WBaidu.NavigateToStream(source);
此時執行,發覺沒有警告框了.