OLD | NEW |
1 <div id="pageData-name" class="pageData" | 1 <div id="pageData-name" class="pageData" |
2 >chrome.experimental.devtools.inspectedWindow.* APIs</div> | 2 >chrome.experimental.devtools.inspectedWindow.* APIs</div> |
3 | 3 |
4 <p> | 4 <p> |
5 Use <code>chrome.experimental.devtools.inspectedWindow</code> to interact with | 5 Use <code>chrome.experimental.devtools.inspectedWindow</code> to interact with |
6 the inspected window: obtain tab ID for the inspected page, evaluate the code | 6 the inspected window: obtain tab ID for the inspected page, evaluate the code |
7 in the context of inspected window, reload the page. | 7 in the context of inspected window, reload the page. |
8 </p><p> | 8 </p><p> |
9 See <a href="experimental.devtools.html">DevTools APIs summary</a> for | 9 See <a href="experimental.devtools.html">DevTools APIs summary</a> for |
10 general introduction to using Developer Tools APIs. | 10 general introduction to using Developer Tools APIs. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 Due to the security considerations explained above, | 49 Due to the security considerations explained above, |
50 <a href="tabs.html#method-executeScript"><code | 50 <a href="tabs.html#method-executeScript"><code |
51 >chrome.tabs.executeScript()</code></a> is the preferred way for an extension | 51 >chrome.tabs.executeScript()</code></a> is the preferred way for an extension |
52 to access DOM data of the inspected page in cases where the access to | 52 to access DOM data of the inspected page in cases where the access to |
53 JavaScript state of the inspected page is not required.</em> | 53 JavaScript state of the inspected page is not required.</em> |
54 </p><p> | 54 </p><p> |
55 The <code>reload()</code> may be used to reload the inspected page. | 55 The <code>reload()</code> may be used to reload the inspected page. |
56 Additionally, a user agent string may be specifcied, which will cause Chrome | 56 Additionally, a user agent string may be specifcied, which will cause Chrome |
57 to use the given string in the User-Agent HTTP header while fetching the page | 57 to use the given string in the User-Agent HTTP header while fetching the page |
58 and its resources, and return it to the scripts running in that page. | 58 and its resources, and return it to the scripts running in that page. |
| 59 </p><p> |
| 60 Use the <code>getResources()</code> call and the <code>onResourceContent</code> |
| 61 event to obtain the list of resources (documents, stylesheets, scripts, images |
| 62 etc) within the inspected page. The <code>getContent()</code> and <code |
| 63 >setContent()</code> methods of the <code>Resource</code> class along with the |
| 64 <code>onResourceContentCommitted</code> event may be used to support |
| 65 modification of the resource content, e.g. by an external editor. |
59 </p> | 66 </p> |
60 | 67 |
61 <h2 id="overview-examples">Examples</h2> | 68 <h2 id="overview-examples">Examples</h2> |
62 <p>The following code checks for the version of jQuery used by the inspected | 69 <p>The following code checks for the version of jQuery used by the inspected |
63 page: | 70 page: |
64 | 71 |
65 <pre> | 72 <pre> |
66 chrome.experimental.devtools.inspectedWindow.eval( | 73 chrome.experimental.devtools.inspectedWindow.eval( |
67 "jQuery.fn.jquery", | 74 "jQuery.fn.jquery", |
68 function(result, isException) { | 75 function(result, isException) { |
69 if (isException) | 76 if (isException) |
70 console.log("the page is not using jQuery"); | 77 console.log("the page is not using jQuery"); |
71 else | 78 else |
72 console.log("The page is using jQuery v" + result); | 79 console.log("The page is using jQuery v" + result); |
73 } | 80 } |
74 ); | 81 ); |
75 </pre> | 82 </pre> |
76 | 83 |
77 <p> | 84 <p> |
78 You can find more examples that use Developer Tools APIs in | 85 You can find more examples that use Developer Tools APIs in |
79 <a href="samples.html#devtools">Samples</a>. | 86 <a href="samples.html#devtools">Samples</a>. |
80 </p> | 87 </p> |
OLD | NEW |