Skip to main content
 首页 » 编程设计

c#之浏览器控件中刷新和导航功能的区别

2024年02月13日11zhoujg

昨天我遇到了一个用于显示“浏览量”(即访问该页面的人数)的网站。当我单击刷新按钮时,计数开始增加。

然后我编写了这个小应用程序来增加观看次数。

 browser = new WebBrowser(); 
 for (int index = 0; index < 250000; index++) 
 { 
   { 
     browser.Navigate("url"); 
     System.Threading.Thread.Sleep(100); 
   } 
 } 

我报告了这个错误,他们已经纠正了它。现在即使我按下 F5 按钮,观看次数也不会增加。但是当我运行上面的程序时,次数开始增加..

谁能解释一下 Navigate 函数和 Refresh(F5) 之间的区别?

请您参考如下方法:

Navigate

Loads the document at the specified Uniform Resource Locator (URL) into the WebBrowser control, replacing the previous document.

Refresh

Reloads the document currently displayed in the WebBrowser control.

A document refresh simply reloads the current page, so the Navigating, Navigated, and DocumentCompleted events do not occur when you call the Refresh method.

注意:链接用于浏览器控制,但我认为它们的信息是有效的