修改用户代理JavaScript

修改用户代理JavaScript,javascript,windows-phone-7,browser,user-agent,Javascript,Windows Phone 7,Browser,User Agent,是否可以使用JavaScript修改userAgent? 我个人只知道getter window.navigator.userAgent,但这对我没有帮助。这应该可以 navigator.__defineGetter__('userAgent', function(){ return 'foo' // customized user agent }); navigator.userAgent; // 'foo'​​​​​​​​​​​​​​​​​​ 这应该行得通 navigator._

是否可以使用JavaScript修改userAgent? 我个人只知道getter window.navigator.userAgent,但这对我没有帮助。

这应该可以

navigator.__defineGetter__('userAgent', function(){
    return 'foo' // customized user agent
});

navigator.userAgent; // 'foo'​​​​​​​​​​​​​​​​​​
这应该行得通

navigator.__defineGetter__('userAgent', function(){
    return 'foo' // customized user agent
});

navigator.userAgent; // 'foo'​​​​​​​​​​​​​​​​​​

HTTP头?不,不能使用JavaScript修改(请求)头
navgiator.userAgent
?只有通过使用技巧。如果您使用WebBrowser控件,您可以在导航方法中使用它吗?我认为WP7WebBrowser控件有点不同,没有标准的解决方案。HTTP头?不,不能使用JavaScript修改(请求)头
navgiator.userAgent
?只有通过使用技巧。如果您使用WebBrowser控件,您可以在导航方法中使用它吗?WP7WebBrowser控件有点不同,我认为没有标准的解决方案,或者
Object.defineProperty(navigator,'userAgent',{value:'foo'})最后一行只是证明,不是吗?我试试这个。是的,只是为了确定一下。我没有在所有浏览器中测试过。或者
Object.defineProperty(navigator,'userAgent',{value:'foo'})最后一行只是证明,不是吗?我试试这个。是的,只是为了确定一下。我没有在所有浏览器中测试。