From 80d4717057c16dba9ff2e629b85022603252b031 Mon Sep 17 00:00:00 2001 From: "caseq@google.com" Date: Mon, 1 Aug 2011 18:23:36 +0000 Subject: Added docs for chrome.experimental.devtools.inspectedWindow BUG=none TEST=none Review URL: http://codereview.chromium.org/7468001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94939 0039d316-1c4b-4281-b951-d872f2087c98 --- .../experimental.devtools.inspectedWindow.html | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 chrome/common/extensions/docs/static/experimental.devtools.inspectedWindow.html (limited to 'chrome/common/extensions/docs/static') diff --git a/chrome/common/extensions/docs/static/experimental.devtools.inspectedWindow.html b/chrome/common/extensions/docs/static/experimental.devtools.inspectedWindow.html new file mode 100644 index 0000000..7ab4add --- /dev/null +++ b/chrome/common/extensions/docs/static/experimental.devtools.inspectedWindow.html @@ -0,0 +1,80 @@ +
chrome.experimental.devtools.inspectedWindow.* APIs
+ +

+Use chrome.experimental.devtools.inspectedWindow to interact with +the inspected window: obtain tab ID for the inspected page, evaluate the code +in the context of inspected window, reload the page. +

+See DevTools APIs summary for +general introduction to using Developer Tools APIs. +

+ +

Notes

+

+The tabId property +provides tab identifier that may be used with the +chrome.tabs.* API calls. +However, please note that chrome.tabs.* API is not +exposed to the Developer Tools extension pages due to security considerations +— you will need to pass the tab ID to the background page and invoke +the chrome.tabs.* API functions from there. +

+The eval() provides the ability for extensions to execute +JavaScript code in the context of the main frame of the inspected page. +This function is different from +chrome.tabs.executeScript() in the following aspects: +

+

+Important: +Due to the security considerations explained above, +chrome.tabs.executeScript() is the preferred way for an extension +to access DOM data of the inspected page in cases where the access to +JavaScript state of the inspected page is not required. +

+The reload() may be used to reload the inspected page. +Additionally, a user agent string may be specifcied, which will cause Chrome +to use the given string in the User-Agent HTTP header while fetching the page +and its resources, and return it to the scripts running in that page. +

+ +

Examples

+

The following code checks for the version of jQuery used by the inspected +page: + +

+chrome.experimental.devtools.inspectedWindow.eval(
+    "jQuery.fn.jquery",
+     function(result, isException) {
+       if (isException)
+         console.log("the page is not using jQuery");
+       else
+         console.log("The page is using jQuery v" + result);
+     }
+);
+
+ +

+You can find more examples that use Developer Tools APIs in +Samples. +

-- cgit v1.1