0

I am need to have 7 tabs all having web browser controls and each should have different user agent.I saw this and thought how do they do that? http://www.howtogeek.com/howto/18450/change-the-user-agent-string-in-internet-explorer-8/

and using this for as implementation

Changing the user agent of the WebBrowser control

works like this if i change one browsers string all get same

Community
  • 1
  • 1
Afnan Bashir
  • 7,319
  • 20
  • 76
  • 138
  • Do you have a specific question, if you're just asking how do I write this program from scratch you're unlikely to get very constructive answers. By the way - the tool you refer to - I think it is just changing the user agent string - not actually changing the user agent (i.e. not making IE render like Firefox for example). – James Gaunt Jan 15 '11 at 22:08
  • Are you building a web application or a windows app? – Vadim Jan 15 '11 at 22:09
  • 1
    This just made the #1 spot on my list of Bad Ideas for the Year. Well, it's still young. Pretty offense to the web programmers that struggle with making their web pages work on IE, I don't expect this to last long. – Hans Passant Jan 15 '11 at 22:26
  • Hans makes a good point; the User-Agent field is important for web developers to know how to present the web page in a way that will suit your browser. For the purposes of end-user experience it is important to send the correct information. – ktm5124 Jan 15 '11 at 22:32
  • i am making desktop application. – Afnan Bashir Jan 15 '11 at 22:39
  • how can we change user agent string? @james – Afnan Bashir Jan 15 '11 at 22:39
  • I think looking at the link you've got now - that perhaps the only way is to time the changes in UA string. Depends how your application is built. Can you intercept the events that lead to an HTTP request from each control - and just before the request change the UA string based on which tab it is on? It would appear you can't just set this once for each tab as they all share the underlying COM object settings. – James Gaunt Jan 15 '11 at 22:59
  • nops problem is that i have added two buttons and assign new UA string ant then call navigate to the url but it dose not help – Afnan Bashir Jan 15 '11 at 23:13
  • i thing there is need to refresh it i dont know how – Afnan Bashir Jan 15 '11 at 23:14

1 Answers1

0

User-Agent is an HTTP header field. There are many ways to change it. For Firefox there are definitely plugins you can download that let you modify your HTTP headers on the fly. There is probably a plugin that will let you do do this on a per-tab basis.

This sounds like a browser-specific question. But, in general, when it comes to HTTP, you can send whatever you want. Your browser does it automatically for you, but for Firefox, at least, you can download plugins that give you more control. For other browsers there might be a config file or setting that you can edit.

If you're writing a web browser that lets you do this feature, well, that should be easy as well; the API you are using should let you modify the headers.

ktm5124
  • 11,861
  • 21
  • 74
  • 119
  • Now that I read your question more carefully, it seems you are using IE8, even though you never state this specifically. I believe you can get a lot more control over what you send in Firefox; you may consider switching for whatever ad hoc task requires this. Once again, there might also be a config file, setting, or patch for IE8 in which you can change the User-Agent header field. – ktm5124 Jan 15 '11 at 22:30
  • He is using the `WebBrowser` control that is part of .NET WinForms. It is basically a wrapper around the IE COM Control. – Matt Greer Jan 15 '11 at 23:00