大家好,我正在创建一个 winform 应用程序,在其中向所有用户显示地图,但问题是 Web 浏览器控件将 ie7 作为默认浏览器,而该特定浏览器不支持地图,
error:
您使用的浏览器不受 Google 地图支持
JavaScript API。考虑更换您的浏览器。了解更多关闭
我想从网络浏览器控件打开地图,但不是用 ie,我想用谷歌浏览器显示以消除该错误,
我的系统有很多管理权限,但我无法使用注册表
有什么办法可以做到这一点吗?
VS默认浏览器控件使用IE。 Chrome 浏览器应该使用 cefsharp。
首先包含库并像这样初始化......
public ChromiumWebBrowser browser;
private void InitBrowser()
{
try
{
if (!Cef.IsInitialized)
{
CefSettings settings = new CefSettings();
settings.BrowserSubprocessPath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "CefSharp.BrowserSubprocess.exe");
Cef.Initialize(settings);
}
string url = "www.google.com";
browser = new ChromiumWebBrowser(url);
this.Controls.Add(browser);
browser.Dock = DockStyle.Fill;
browser.IsBrowserInitializedChanged += browser_IsBrowserInitializedChanged;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
private void browser_IsBrowserInitializedChanged(object sender, IsBrowserInitializedChangedEventArgs e)
{
if (((ChromiumWebBrowser)sender).IsBrowserInitialized)
{
//if needed then use dev tool
browser.ShowDevTools();
}
}
欲了解更多信息,请参阅下面的链接...https://github.com/cefsharp/CefSharp https://github.com/cefsharp/CefSharp
https://github.com/cefsharp/CefSharp/wiki/Quick-Start https://github.com/cefsharp/CefSharp/wiki/Quick-Start
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)