WPF WebBrowser 加载 html ,出现安全警告, 运行 脚本和 activeX 控件,

时间:2023-03-09 18:38:38
WPF WebBrowser 加载 html ,出现安全警告, 运行 脚本和 activeX 控件,

对于你的问题,只需要在你的HTML首行添加如下代码即可隐藏安全提示条:

<!-- saved from url=(0014)about:internet -->

WPF WebBrowser 加载 html ,出现安全警告, 运行 脚本和 activeX 控件,

还有一个可选方案是使用Winform的WebBrowser控件,不需要更改HTML代码,也不会出现安全提示,需要WindowsFormsHost:

xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
<Grid>
<WindowsFormsHost>
<wf:WebBrowser x:Name="webbrowser1"/>
</WindowsFormsHost>
</Grid>

可见: http://msdn.microsoft.com/en-us/library/ms751761(v=vs.110).aspx


We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. 
Click HERE to participate the survey.

https://social.msdn.microsoft.com/Forums/sqlserver/zh-CN/f070e94a-92b3-451f-a4af-7fa5265eb818/wpf-webbrowser-html-activex-?forum=wpfzhchs