var wb = new WebBrowser();
            wb.AllowNavigation = true;
            wb.ScriptErrorsSuppressed = false;
            wb.Navigate("about:blank");
            WaitWebbrowser(wb);
            wb.Document.Write("<script>function urlEncode(url){ return encodeURIComponent(encodeURI(url)); }</script>");
            MessageBox.Show(wb.Document.InvokeScript("urlEncode", new object[] { @"http://wwww.baidu.com/音乐" }).ToString());
            wb.Dispose();

 

        void WaitWebbrowser(WebBrowser wb)
        { 
            while(wb.IsBusy ||(wb.ReadyState != WebBrowserReadyState.Complete && wb.ReadyState != WebBrowserReadyState.Interactive ))
                Application.DoEvents();
        }

 

相关文章:

  • 2022-02-08
  • 2021-09-07
  • 2022-12-23
  • 2021-11-18
  • 2022-01-03
  • 2022-12-23
  • 2022-02-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案