Re: How to change User Agent string frequently?



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.

.



Relevant Pages

  • Re: [EGN] Variable hoisting
    ... Re: The Data Quality Act ... In the process I found a SERIOUS bug in the C code. ... CS> The allocated string has no room for the trailing nul. ... An mature adult programmer would have taken it for what ...
    (comp.programming)
  • Re: Comment on trim string function please
    ... I think you have a bug. ... but does it fly past the terminating null character? ... initial space scan) then this writes outside the string. ... ASIDE FROM THE CAST "ISSUES", ...
    (comp.lang.c)
  • Re: Unable to access folder from A2003
    ... Public Sub CheckforUpdates(LocalFile As String, ServerFile As String, ... 'This routine checks for version updates to the front end and other modules: ... Dim dbe As PrivDBEngine ... ' open workspace, database, recordset for Server File. ...
    (comp.databases.ms-access)
  • Re: HUD Text in Virtual Reality Toolbox viewer window
    ... A few people recently asked us how to display continuously changing text in VR Viewer during Simulink simulation. ... You can define a dummy object whose fields correspond to the types of the values you want to display The signal is then sent to virtual scene using the VR Sink block, in VRML file is routed to a script that does the conversion to the text and updates the value of the Text node string displayed in the scene. ...
    (comp.soft-sys.matlab)
  • Weekly Python Patch/Bug Summary
    ... Patch / Bug Summary ... most missing from Windows distribution ... http://python.org/sf/1541585 closed by gbrandl ... Compiler command percent-sign causes format string error ...
    (comp.lang.python)