Some of the advanced features offered by the developer tools can be accessed through the chrome.debugger API (add the debugger permission to the manifest file).
The user agent can be modified using the Network.setUserAgentOverride :
The official documentation for supported protocols and commands can be found here . At the time of writing, there is no documentation for changing device performance. However, after digging into the source code of Chromium, I discovered a file that defined all the currently known commands:
When I look through the list of definitions, I find Page.setDeviceMetricsOverride . This phrase seems to meet our expectations, so let's look further to find out how to use it:
This gives "chromium / src / out / Release / obj / gen / devtools / DevTools.js" (thousands of lines). Somewhere there is a line defining (decorated):
InspectorBackend.registerCommand("Page.setDeviceMetricsOverride", [{ "name": "width", "type": "number", "optional": false }, { "name": "height", "type": "number", "optional": false }, { "name": "fontScaleFactor", "type": "number", "optional": false }, { "name": "fitWindow", "type": "boolean", "optional": false }], []);
How to read it? Well, use your imagination:
chrome.debugger.sendCommand({ tabId: tabId }, "Page.setDeviceMetricsOverride",{ width: 1000, height: 1000, fontScaleFactor: 1, fitWindow: false }, function(response) {
I tested this on Chrome 25 using protocol version 1.0, and it works: Tab debugging changes. Hooray!