通过defineGetter在Firefox和Opera上更改navigator.userAgent
navigator.__defineGetter__('userAgent', function(){
return( "iPhone 5" );
});
alert( navigator.userAgent );
通过对象实例在IE和Opera上更改navigator.userAgent
var navigator = new Object;
navigator.userAgent = 'iPhone 5';
alert( navigator.userAgent );
好东西是,如果您使用IE Web浏览器控件,则可以通过execScript双重欺骗HTTP请求和JavaScript navigator.userAgent。
WebBrowser1.Navigate "http://example.com", , , , "User-Agent: iPhone 5" & vbCrLf
WebBrowser1.Document.parentWindow.execScript ("var navigator=new Object;navigator.userAgent='iPhone 5';")
WebBrowser1.Document.parentWindow.execScript ("alert(navigator.userAgent);") 'iPhone 5