C# Winforms Web Browser

huangapple go评论67阅读模式
英文:

C# Winforms Web Browser

问题

我创建了一个简单的程序,允许我输入一个位置并生成一个可以在 Visual Studio 的 Web 浏览器模块中查看的 Google 地图链接。请参见下面的代码:

string InvoiceQueryLocation = BackgroundLabel1.Text + BackgroundLabel2.Text;
MapBrowser.Navigate("https://www.google.com/maps/search/" + InvoiceQueryLocation + "/");
MapBrowser.ScriptErrorsSuppressed = true;

然而,大约一周前,一切正常,直到默认的 Web 浏览器(我认为是 Chrome)决定在“webbrowser”模块中进行更新。现在,地图查询运行一会儿,然后 Chrome 更新选项卡出现在其上。

我尝试将“AllowNavigation”设置为False,但这会阻止我清除结果并重新开始。

有人知道解决这个问题的方法吗?或者知道我错过了什么吗?
我在多台计算机上尝试过,每次都出现相同的问题。

我尝试过的修复方法:

  • 更新 Windows
  • 更新 Visual Studio
  • 更新 Chrome
  • 将“AllowNavigation”设置为False
英文:

I have created a simple program which allows me to input a location and generate a google maps link which I can view on the Web Browser module wihtin visual studio. See code below:

string InvoiceQueryLocation = BackgroundLabel1.Text + BackgroundLabel2.Text;
MapBrowser.Navigate("https://www.google.com/maps/search/" + InvoiceQueryLocation + "/");
MapBrowser.ScriptErrorsSuppressed = true;

However, until about a week ago, everything worked fine until the default web browser (Chrome I think) decided it needs updating within the "webbrowser" module. Now, the maps query runs, stops for a second and then the Chrome update tab appears over it.

I have tried setting "AllowNavigation" to False, however, this stops me from clearning the results and starting anew.

Does anyone know a solution around this? Or perhaps know what I have missed?
I have tried this on multiple PC's and the same issue occurs each time.

Fixes I have tried -

  • Updating windows
  • Updating Vis studio
  • Updating chrome
  • Setting "AllowNavigation" to False

答案1

得分: 1

我遇到了相同的问题,最终用 Microsoft 的新 WebView2 控件替换了 Web 浏览器控件。

https://learn.microsoft.com/en-us/microsoft-edge/webview2/get-started/winforms

我有一个基于上面链接的示例应用程序,你可以在这里找到它:

示例应用程序 - 使用地址或纬度经度查找地址

英文:

I faced same problem and ended up replacing web browser control with Microsoft's new WebView2 control

https://learn.microsoft.com/en-us/microsoft-edge/webview2/get-started/winforms

I have a sample application based on the above link here....

Sample Application - Use address or lat long to find address

huangapple
  • 本文由 发表于 2023年5月10日 20:35:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/76218500.html
  • c#
  • winforms

为所有缺失的枚举添加到List中。 go 66
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定

  • 开发者交流平台

    本页二维码