Re: How to change User Agent string frequently?
- From: bayden@xxxxxxxxx
- Date: 9 Nov 2006 21:38:09 -0800
The bug is that calling URLMON_OPTION_USERAGENT typically only updates
the value returned to the object model (e.g.
window.navigator.userAgent) and does not update the value set inside
WinINET. For the moment, the only workaround I can think of is to:
1> Back up the User-Agent registry keys in the registry
2> Change those keys to a different value
3> Call URLMON_OPTION_USERAGENTREFRESH
4> Restore the previously-backed-up registry keys.
Of course, for a web browser control, your best option by far is to
simply use the Ambient property.
What exactly are you hoping to use this to accomplish?
mladen074@xxxxxxxxx wrote:
Thank you very much for the help, I really appreciate it.
One question though, I'm not a native english speaker, so I didn't
manage to understand the part about URLMON_OPTION_USERAGENTREFRESH. So
could you please explain it just a little bit. Thanks.
I've tried something like this:
-
UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, ...);
WebBrowser.Navigate(...);
...
UrlMkSetSessionOption(URLMON_OPTION_USERAGENT_REFRESH, nil, 0, 0);
UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, ...);
WebBrowser.Navigate(...);
-
and that worked in a way so it sets the UA string first time, then it
restores the IE default UA string, and after that I cannot set the UA
string anymore :)
I've figured out that it's some kind of a bug, but I couldn't find any
function to stop/close the current WinINET internet session, so the
WebBrowser component would be able to reinitialize the session (reading
the UA string again), but I couldn't find any such function :(
Thanks again for all your help.
M.
.
- Follow-Ups:
- Re: How to change User Agent string frequently?
- From: mladen074
- Re: How to change User Agent string frequently?
- Prev by Date: Re: E_ACCESSDENIED when accessing a specific Frame
- Next by Date: How to show a tool tip on an IWebbrowser2 control embedded in a Cdialog
- Previous by thread: E_ACCESSDENIED when accessing a specific Frame
- Next by thread: Re: How to change User Agent string frequently?
- Index(es):
Relevant Pages
|
|