├── README.md
├── chrome-user-agent.crx
└── src
├── background.html
├── background.js
├── icon128.png
├── icon16.png
├── icon19.png
├── icon48.png
├── json2.js
├── manifest.json
├── options.html
├── options.js
└── style.css
/README.md:
--------------------------------------------------------------------------------
1 | # This project has been deprecated.
2 |
3 | Starting with version 17, the Google Chrome browser ships with support for
4 | modifying the User-Agent string. ([Click here for the Chromium
5 | issue](http://code.google.com/p/chromium/issues/detail?id=67063) and [here for
6 | more info on the
7 | feature](http://techdows.com/2011/12/google-chrome-now-has-built-in-user-agent-switcher.html).)
8 | This renders the dedicated user-agent switching extension obsolete, but the
9 | approach outlined here may still be relevant in the context of a larger
10 | extension.
11 |
12 | Chrome User-Agent Modifier Extension
13 | ====================================
14 |
15 | Allows you to re-set the "User-Agent" string in Chrome's HTTP request headers.
16 |
17 | Installation Instructions
18 | -------------------------
19 |
20 | **Download the Extension.** You can get the latest version of the [extension
21 | here](https://raw.github.com/jugglinmike/chrome-user-agent/master/chrome-user-agent.crx)
22 | (of course, you'll need [Google Chrome](http://www.google.com/chrome) installed
23 | first).
24 |
25 | **Install the Application.** Drag the extension file (it is named
26 | 'chrome-ua-modifier.crx' by default) into a Chrome browser window.
27 |
28 | How to Run
29 | ----------
30 |
31 | **Changing Your User-Agent.** The extension options can be accessed either by
32 | selecting "Options" under the extension's entry on chrome://extensions or clicking on the
34 | extension's logo () next to Chrome's omnibox. Select
35 | any entry from the device list, and all future HTTP requests will be sent with
36 | the user-agent string displayed in the text area. Select "default" to use your
37 | default user-agent string.
38 |
39 | **Adding/Modifying "Devices".** Click "Add a Device" to create a new device--be
40 | sure to type a device name in the text area that appears. (You can double-click
41 | any device to change its name.) If you want to change the User-Agent string
42 | associated with any device, select it from the list and modify the text in the
43 | "Current User-Agent" text area. (I have found this page on zytrax.com to be a great resource for valid
46 | user-agent strings.)
47 |
48 | **Deleting "Devices".** If you no longer need a saved device, simply
49 | double-click on its entry in the list and clear the text area.
50 |
--------------------------------------------------------------------------------
/chrome-user-agent.crx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jugglinmike/chrome-user-agent/64e82ed8b44bc4b77bcfc9c84bc414cb3bd34aae/chrome-user-agent.crx
--------------------------------------------------------------------------------
/src/background.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/background.js:
--------------------------------------------------------------------------------
1 | var requestFilter = {
2 | urls: [
3 | ""
4 | ]
5 | };
6 |
7 | chrome.webRequest.onBeforeSendHeaders.addListener(function(details) {
8 | var headers = details.requestHeaders;
9 | if( !localStorage['user-agent'] ) {
10 | return;
11 | }
12 | for(var i = 0, l = headers.length; i < l; ++i) {
13 | if( headers[i].name == 'User-Agent' ) {
14 | break;
15 | }
16 | }
17 | if(i < headers.length) {
18 | headers[i].value = localStorage['user-agent'];
19 | }
20 | return {requestHeaders: headers};
21 | }, requestFilter, ['requestHeaders','blocking']);
--------------------------------------------------------------------------------
/src/icon128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jugglinmike/chrome-user-agent/64e82ed8b44bc4b77bcfc9c84bc414cb3bd34aae/src/icon128.png
--------------------------------------------------------------------------------
/src/icon16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jugglinmike/chrome-user-agent/64e82ed8b44bc4b77bcfc9c84bc414cb3bd34aae/src/icon16.png
--------------------------------------------------------------------------------
/src/icon19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jugglinmike/chrome-user-agent/64e82ed8b44bc4b77bcfc9c84bc414cb3bd34aae/src/icon19.png
--------------------------------------------------------------------------------
/src/icon48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jugglinmike/chrome-user-agent/64e82ed8b44bc4b77bcfc9c84bc414cb3bd34aae/src/icon48.png
--------------------------------------------------------------------------------
/src/json2.js:
--------------------------------------------------------------------------------
1 | var JSON;if(!JSON){JSON={};}
2 | (function(){"use strict";function f(n){return n<10?'0'+n:n;}
3 | if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
4 | f(this.getUTCMonth()+1)+'-'+
5 | f(this.getUTCDate())+'T'+
6 | f(this.getUTCHours())+':'+
7 | f(this.getUTCMinutes())+':'+
8 | f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
9 | var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
10 | function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
11 | if(typeof rep==='function'){value=rep.call(holder,key,value);}
12 | switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
13 | gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i",
22 | "tabs"
23 | ]
24 | }
--------------------------------------------------------------------------------
/src/options.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |