The user agent strings identify what a user is using to access a web resource. some websites may deliver (slightly) different content depending upon what browser is being used. For example, if you use a iPhone user agent to browse to a WordPress site like https://theroadtodelphi.wordpress.com the result will see something like this :
As you can see the content is designed to fit with a mobile device. in this post I will show how you can change the user agent of a TWebBrowser component.
to change the UA of TWebBrowser you must call the OnAmbientPropertyChange event of the IOleControl interface with theDISPID_AMBIENT_USERAGENT flag and in the implementation of the Invoke function for the IDispatch interface set the value for the New User Agent String.
check the next source code using a interposer class of the TWebBrowser which declare a new property called UserAgent in the component.
and the implementation
Now to use the above code your only need to add a TWebBrowser component to your form, then add the declaration of the New TWebBrowser class to begin of your unit and finally you must add the implementation of the methods show in this article.
Now to set the new user agent, you only must set the UserAgent property.
check the screen-shots for the demo application
For more info about User Agent strings check these links
查看源码 点击 Github.