English 中文(简体)
Chrome 推广:修改用户-代理人
原标题:Chrome Extension : Modify User-Agent string
  • 时间:2011-11-02 09:39:14
  •  标签:
  • user-agent

在延伸方面,我们可以:

var _prefService =  Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var httpHandler = Cc["@mozilla.org/network/protocol;1?name=http"].getService(Ci.nsIHttpProtocolHandler);
setCharPref("general.useragent.override",httpHandler.userAgent + " OurUAToken/1.0");

添加“OurUAToken/1.0”在用户-代理人扼杀结束时。

如何在谷歌中重复这一行为?

最佳回答

<代码>chrome.webRequest 先前建议的APIC现在相当稳定。

chrome.webRequest.onBeforeSendHeaders.addListener(
  function (details) {
    for (var i = 0; i < details.requestHeaders.length; ++i) {
      if (details.requestHeaders[i].name === "User-Agent") {
        details.requestHeaders[i].value = details.requestHeaders[i].value + " OurUAToken/1.0";
        break;
      }
    }
    return { requestHeaders: details.requestHeaders };
  },
  { urls: ["<all_urls>"] },
  ["blocking", "requestHeaders"]
);

其中一项延期,Requestly 已经有类似的执行,允许用户在浏览器上开设的任何网站进行紧急铺设。


欲了解更多信息,请访问博客:

The extension is also available for Firefox. Visit http://www.requestly.in for details.

问题回答

http://code.google.com/chrome/extensions/trunk/experimental.webRequest.html”rel=“nofollow” http://code.google.com/chrome/extensions/trunk/experimental.webRequest.html

不幸的是,它仍处于实验阶段。 我认为,它将与第17号 Chrome法一样获得释放。





相关问题
What is the iPad user agent?

From what I gather, the iPad is using iPhone OS, but with a different screen resolution from the iPhone and iPod touch. So many sites may have to change their user agent detection to adapt to the iPad....

Code to parse user agent string?

As strange as I find this, I have not been able to find a good PHP function anywhere which will do an intelligent parse of a user agent string? Googled it for about 20 minutes now. I have the string ...

How can i remove chromeframe from IE8 User Agent?

I removed Chrome Frame from my system but IE8 User Agent still has chromeframe in it. How can I remove Chrome Frame entirely? Can I somehow reset all IE8 settings or is my only choice somekind of User-...

Activate <div> based on User Agent

I need to activate a "div" based on the user agent string. For example, (and this is my actual use for this,) A user with Firefox comes to my site. I want to tell them something along the lines of "...

How to set User-Agent in python-twitter?

i m writing a small script to tweet messages from the monitoring systems. The only issue i ran into so far is that i can t set the User-Agent correctly, all tweets show up as "from API" which ain t a ...

What does default CSS s browsers depend on?

Hi (please excuse me for my ugly english ;-) ) Do you know if the default CSS of any user agent ... : depends on its release number ? depends on its layout engine ? depends on the release number of ...

热门标签