[ C# ] WebBrowser 컨트롤의 User-Agent 변경하기
개발/C# - 2013. 4. 25. 19:15 - 김똘똘
예전에 만들어뒀던 샘플용 프로젝트가 생각나서 다시 한번 깔끔하게 코드 정리하고 GitHub에 커밋했다.
핵심 소스는 아래에 있으며, 예제 프로젝트는 https://github.com/DevBird/Change-WebBrowser-UserAgent-Example에 커밋하여놨다.
RegistryKey rk = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent", true); rk.SetValue(null, "Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"); wb.Navigate(txtURL.Text); while (this.wb.Document == null) { Application.DoEvents(); } rk.SetValue(null, "");