OLD | NEW |
| (Empty) |
1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: | |
2 1) The <head> information in this page is significant, should be uniform | |
3 across api docs and should be edited only with knowledge of the | |
4 templating mechanism. | |
5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a | |
6 browser, it will be re-generated from the template, json schema and | |
7 authored overview content. | |
8 4) The <body>.innerHTML is also generated by an offline step so that this | |
9 page may easily be indexed by search engines. | |
10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> | |
11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
12 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css"> | |
13 <link href="css/print.css" rel="stylesheet" type="text/css" media="print"> | |
14 <script type="text/javascript" src="../../../third_party/jstemplate/jstempla
te_compiled.js"> | |
15 </script> | |
16 <script type="text/javascript" src="../../../../third_party/json_minify/mini
fy-sans-regexp.js"> | |
17 </script> | |
18 <script type="text/javascript" src="js/api_page_generator.js"></script> | |
19 <script type="text/javascript" src="js/bootstrap.js"></script> | |
20 <script type="text/javascript" src="js/sidebar.js"></script> | |
21 <meta name="description" content="Documentation for the chrome.devtools.inspec
tedWindow module, which is part of the Google Chrome extension APIs."><title>ch
rome.devtools.inspectedWindow.* APIs - Google Chrome Extensions - Google Code</t
itle></head> | |
22 <body> <div id="devModeWarning" class="displayModeWarning"> | |
23 You are viewing extension docs in chrome via the 'file:' scheme: are you exp
ecting to see local changes when you refresh? You'll need run chrome with --allo
w-file-access-from-files. | |
24 </div> | |
25 <div id="branchWarning" class="displayModeWarning"> | |
26 <span>WARNING: This is the <span id="branchName">BETA</span> documentation. | |
27 It may not work with the stable release of Chrome.</span> | |
28 <select id="branchChooser"> | |
29 <option>Choose a different version... | |
30 </option><option value="">Stable | |
31 </option><option value="beta">Beta | |
32 </option><option value="dev">Dev | |
33 </option><option value="trunk">Trunk | |
34 </option></select> | |
35 </div> | |
36 <div id="unofficialWarning" class="displayModeWarning"> | |
37 <span>WARNING: This is unofficial documentation. It may not work with the | |
38 current release of Chrome.</span> | |
39 <button id="goToOfficialDocs">Go to the official docs</button> | |
40 </div> | |
41 <div id="gc-container" class="labs"> | |
42 <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION --> | |
43 <!-- In particular, sub-templates that recurse, must be used by allowing | |
44 jstemplate to make a copy of the template in this section which | |
45 are not operated on by way of the jsskip="true" --> | |
46 <!-- /SUBTEMPLATES --> | |
47 <a id="top"></a> | |
48 <div id="skipto"> | |
49 <a href="#gc-pagecontent">Skip to page content</a> | |
50 <a href="#gc-toc">Skip to main navigation</a> | |
51 </div> | |
52 <!-- API HEADER --> | |
53 <table id="header" width="100%" cellspacing="0" border="0"> | |
54 <tbody><tr> | |
55 <td valign="middle"><a href="http://code.google.com/"><img src="images/c
ode_labs_logo.gif" height="43" width="161" alt="Google Code Labs" style="border:
0; margin:0;"></a></td> | |
56 <td valign="middle" width="100%" style="padding-left:0.6em;"> | |
57 <form action="http://www.google.com/cse" id="cse" style="margin-top:0.
5em"> | |
58 <div id="gsc-search-box"> | |
59 <input type="hidden" name="cx" value="002967670403910741006:61_cvz
fqtno"> | |
60 <input type="hidden" name="ie" value="UTF-8"> | |
61 <input type="text" name="q" value="" size="55"> | |
62 <input class="gsc-search-button" type="submit" name="sa" value="Se
arch"> | |
63 <br> | |
64 <span class="greytext">e.g. "page action" or "tabs"</span> | |
65 </div> | |
66 </form> | |
67 <script type="text/javascript" src="https://www.google.com/jsapi"></sc
ript> | |
68 <script type="text/javascript">google.load("elements", "1", {packages:
"transliteration"});</script> | |
69 <script type="text/javascript" src="https://www.google.com/coop/cse/t1
3n?form=cse&t13n_langs=en"></script> | |
70 <script type="text/javascript" src="https://www.google.com/coop/cse/br
and?form=cse&lang=en"></script> | |
71 </td> | |
72 </tr> | |
73 </tbody></table> | |
74 <div id="codesiteContent" class=""> | |
75 <a id="gc-topnav-anchor"></a> | |
76 <div id="gc-topnav"> | |
77 <h1>Google Chrome Extensions (<a href="http://code.google.com/labs/">Lab
s</a>)</h1> | |
78 <ul id="home" class="gc-topnav-tabs"> | |
79 <li id="home_link"> | |
80 <a href="index.html" title="Google Chrome Extensions home page">Home
</a> | |
81 </li> | |
82 <li id="docs_link"> | |
83 <a href="docs.html" title="Official Google Chrome Extensions documen
tation">Docs</a> | |
84 </li> | |
85 <li id="faq_link"> | |
86 <a href="faq.html" title="Answers to frequently asked questions abou
t Google Chrome Extensions">FAQ</a> | |
87 </li> | |
88 <li id="samples_link"> | |
89 <a href="samples.html" title="Sample extensions (with source code)">
Samples</a> | |
90 </li> | |
91 <li id="group_link"> | |
92 <a href="http://groups.google.com/a/chromium.org/group/chromium-exte
nsions" title="Google Chrome Extensions developer forum">Group</a> | |
93 </li> | |
94 <li id="so_link"> | |
95 <a href="http://stackoverflow.com/questions/tagged/google-chrome-ext
ension" title="[google-chrome-extension] tag on Stack Overflow">Questions?</a> | |
96 </li> | |
97 </ul> | |
98 </div> <!-- end gc-topnav --> | |
99 <div class="g-section g-tpl-170"> | |
100 <!-- SIDENAV --> | |
101 <div class="g-unit g-first" id="gc-toc"> | |
102 <ul> | |
103 <li><a href="getstarted.html">Getting Started</a></li> | |
104 <li><a href="overview.html">Overview</a></li> | |
105 <li><a href="whats_new.html">What's New?</a></li> | |
106 <li><h2><a href="devguide.html">Developer's Guide</a></h2> | |
107 <ul> | |
108 <li>Browser UI | |
109 <ul> | |
110 <li><a href="browserAction.html">Browser Actions</a></li> | |
111 <li><a href="contextMenus.html">Context Menus</a></li> | |
112 <li><a href="notifications.html">Desktop Notifications</a></li
> | |
113 <li><a href="omnibox.html">Omnibox</a></li> | |
114 <li><a href="options.html">Options Pages</a></li> | |
115 <li><a href="override.html">Override Pages</a></li> | |
116 <li><a href="pageAction.html">Page Actions</a></li> | |
117 </ul> | |
118 </li> | |
119 <li>Browser Interaction | |
120 <ul> | |
121 <li><a href="bookmarks.html">Bookmarks</a></li> | |
122 <li><a href="cookies.html">Cookies</a></li> | |
123 <li><a href="devtools.html">Developer Tools</a></li> | |
124 <li><a href="events.html">Events</a></li> | |
125 <li><a href="history.html">History</a></li> | |
126 <li><a href="management.html">Management</a></li> | |
127 <li><a href="tabs.html">Tabs</a></li> | |
128 <li><a href="windows.html">Windows</a></li> | |
129 </ul> | |
130 </li> | |
131 <li>Implementation | |
132 <ul> | |
133 <li><a href="a11y.html">Accessibility</a></li> | |
134 <li><a href="background_pages.html">Background Pages</a></li> | |
135 <li><a href="content_scripts.html">Content Scripts</a></li> | |
136 <li><a href="xhr.html">Cross-Origin XHR</a></li> | |
137 <li><a href="i18n.html">Internationalization</a></li> | |
138 <li><a href="messaging.html">Message Passing</a></li> | |
139 <li><a href="permissions.html">Optional Permissions</a></li> | |
140 <li><a href="npapi.html">NPAPI Plugins</a></li> | |
141 </ul> | |
142 </li> | |
143 <li>Finishing | |
144 <ul> | |
145 <li><a href="hosting.html">Hosting</a></li> | |
146 <li><a href="external_extensions.html">Other Deployment Option
s</a></li> | |
147 </ul> | |
148 </li> | |
149 </ul> | |
150 </li> | |
151 <li><h2><a href="apps.html">Packaged Apps</a></h2></li> | |
152 <li><h2><a href="tutorials.html">Tutorials</a></h2> | |
153 <ul> | |
154 <li><a href="tut_debugging.html">Debugging</a></li> | |
155 <li><a href="tut_analytics.html">Google Analytics</a></li> | |
156 <li><a href="tut_oauth.html">OAuth</a></li> | |
157 </ul> | |
158 </li> | |
159 <li><h2>Reference</h2> | |
160 <ul> | |
161 <li>Formats | |
162 <ul> | |
163 <li><a href="manifest.html">Manifest Files</a></li> | |
164 <li><a href="match_patterns.html">Match Patterns</a></li> | |
165 </ul> | |
166 </li> | |
167 <li><a href="permission_warnings.html">Permission Warnings</a></li
> | |
168 <li><a href="api_index.html">chrome.* APIs</a></li> | |
169 <li><a href="api_other.html">Other APIs</a></li> | |
170 </ul> | |
171 </li> | |
172 <li><h2><a href="samples.html">Samples</a></h2></li> | |
173 <div class="line"> </div> | |
174 <li><h2>More</h2> | |
175 <ul> | |
176 <li><a href="http://code.google.com/chrome/webstore/docs/index.htm
l">Chrome Web Store</a></li> | |
177 <li><a href="http://code.google.com/chrome/apps/docs/developers_gu
ide.html">Hosted Apps</a></li> | |
178 <li><a href="themes.html">Themes</a></li> | |
179 </ul> | |
180 </li> | |
181 </ul> | |
182 </div> | |
183 <script> | |
184 initToggles(); | |
185 </script> | |
186 <div class="g-unit" id="gc-pagecontent"> | |
187 <div id="pageTitle"> | |
188 <h1 class="page_title">chrome.devtools.inspectedWindow.* APIs</h1> | |
189 </div> | |
190 <!-- TABLE OF CONTENTS --> | |
191 <div id="toc"> | |
192 <h2>Contents</h2> | |
193 <ol> | |
194 <li> | |
195 <a href="#H2-0">Overview</a> | |
196 <ol> | |
197 </ol> | |
198 </li><li> | |
199 <a href="#overview-examples">Examples</a> | |
200 <ol> | |
201 </ol> | |
202 </li> | |
203 <li> | |
204 <a href="#apiReference">API reference: chrome.devtools.inspected
Window</a> | |
205 <ol> | |
206 <li> | |
207 <a href="#properties">Properties</a> | |
208 <ol> | |
209 <li> | |
210 <a href="#property-tabId">tabId</a> | |
211 </li> | |
212 </ol> | |
213 </li> | |
214 <li> | |
215 <a href="#global-methods">Methods</a> | |
216 <ol> | |
217 <li> | |
218 <a href="#method-eval">eval</a> | |
219 </li><li> | |
220 <a href="#method-getResources">getResources</a> | |
221 </li><li> | |
222 <a href="#method-reload">reload</a> | |
223 </li> | |
224 </ol> | |
225 </li> | |
226 <li> | |
227 <a href="#global-events">Events</a> | |
228 <ol> | |
229 <li> | |
230 <a href="#event-onResourceAdded">onResourceAdded</a> | |
231 </li><li> | |
232 <a href="#event-onResourceContentCommitted">onResourceContentCom
mitted</a> | |
233 </li> | |
234 </ol> | |
235 </li> | |
236 <li> | |
237 <a href="#types">Types</a> | |
238 <ol> | |
239 <li> | |
240 <a href="#type-Resource">Resource</a> | |
241 <ol> | |
242 <li> | |
243 <a href="#global-Resource-methods">Methods</a> | |
244 <ol> | |
245 <li> | |
246 <a href="#method-Resource-getContent">getContent</a> | |
247 </li><li> | |
248 <a href="#method-Resource-setContent">setContent</a> | |
249 </li> | |
250 </ol> | |
251 </li> | |
252 </ol> | |
253 </li> | |
254 </ol> | |
255 </li> | |
256 </ol> | |
257 </li> | |
258 </ol> | |
259 </div> | |
260 <!-- /TABLE OF CONTENTS --> | |
261 <!-- Standard content lead-in for experimental API pages --> | |
262 <!-- STATIC CONTENT PLACEHOLDER --> | |
263 <div id="static"><div id="pageData-name" class="pageData">chrome.devtool
s.inspectedWindow.* APIs</div> | |
264 <p> | |
265 Use <code>chrome.devtools.inspectedWindow</code> | |
266 to interact with the inspected window: | |
267 obtain the tab ID for the inspected page, | |
268 evaluate the code in the context of inspected window, | |
269 reload the page, | |
270 or obtain the list of resources within the page. | |
271 </p><p> | |
272 See <a href="devtools.html">DevTools APIs summary</a> for | |
273 general introduction to using Developer Tools APIs. | |
274 </p> | |
275 <a name="H2-0"></a><h2>Overview</h2> | |
276 <p> | |
277 The <a href="#property-tabId"><code>tabId</code></a> property | |
278 provides the tab identifier that you can use with the | |
279 <a href="tabs.html"><code>chrome.tabs.*</code></a> API calls. | |
280 However, please note that <code>chrome.tabs.*</code> API is not | |
281 exposed to the Developer Tools extension pages due to security considerations | |
282 — you will need to pass the tab ID to the background page and invoke | |
283 the <code>chrome.tabs.*</code> API functions from there. | |
284 </p> | |
285 <p> | |
286 The <code>eval()</code> method provides the ability for extensions to execute | |
287 JavaScript code in the context of the main frame of the inspected page. | |
288 This method is powerful when used in the right context | |
289 and dangerous when used inappropriately. | |
290 Use the <code>chrome.tabs.executeScript()</code> method | |
291 unless you need the specific functionality | |
292 that the <code>eval()</code> method provides. | |
293 </p> | |
294 <p>Here are the main differences between the | |
295 <code>eval()</code> and <code>chrome.tabs.executeScript()</code> methods: | |
296 </p><ul> | |
297 <li>The <code>eval()</code> method does not | |
298 use an isolated world for the code being evaluated, so the JavaScript state | |
299 of the inspected window is accessible to the code. | |
300 Use this method when access to the JavaScript state of the inspected page | |
301 is required. | |
302 </li><li> | |
303 The execution context of the code being evaluated includes the | |
304 <a href="http://code.google.com/chrome/devtools/docs/console.html">Developer | |
305 Tools console API</a>. | |
306 For example, | |
307 the code can use <code>inspect()</code> and <code>$0</code>. | |
308 </li><li> | |
309 The evaluated code may return a value that is passed to the extension callback. | |
310 The returned value has to be a valid JSON object (it may contain only | |
311 primitive JavaScript types and acyclic references to other JSON | |
312 objects). | |
313 <em>Please observe extra care while processing the data received from the | |
314 inspected page — the execution context is essentially controlled by the | |
315 inspected page; a malicious page may affect the data being returned to the | |
316 extension.</em> | |
317 </li></ul> | |
318 <p class="caution"> | |
319 <strong>Important:</strong> | |
320 Due to the security considerations explained above, the | |
321 <a href="tabs.html#method-executeScript"><code>chrome.tabs.executeScript()</code
></a> method is the preferred way for an | |
322 extension to access DOM data of the inspected page in cases where the access to | |
323 JavaScript state of the inspected page is not required. | |
324 </p><p> | |
325 The <code>reload()</code> method may be used to reload the inspected page. | |
326 Additionally, the caller can specify an override for the user agent string, | |
327 a script that will be injected early upon page load, and an option to force | |
328 reload of cached resources. | |
329 </p><p> | |
330 Use the <code>getResources()</code> call and the <code>onResourceContent</code> | |
331 event to obtain the list of resources (documents, stylesheets, scripts, images | |
332 etc) within the inspected page. The <code>getContent()</code> and <code>setConte
nt()</code> methods of the <code>Resource</code> class along with the | |
333 <code>onResourceContentCommitted</code> event may be used to support | |
334 modification of the resource content, for example, by an external editor. | |
335 </p> | |
336 <h2 id="overview-examples">Examples</h2> | |
337 <p>The following code checks for the version of jQuery used by the inspected | |
338 page: | |
339 </p><pre>chrome.devtools.inspectedWindow.eval( | |
340 "jQuery.fn.jquery", | |
341 function(result, isException) { | |
342 if (isException) | |
343 console.log("the page is not using jQuery"); | |
344 else | |
345 console.log("The page is using jQuery v" + result); | |
346 } | |
347 ); | |
348 </pre> | |
349 <p> | |
350 You can find more examples that use Developer Tools APIs in | |
351 <a href="samples.html#devtools">Samples</a>. | |
352 </p> | |
353 </div> | |
354 <!-- API PAGE --> | |
355 <div class="apiPage"> | |
356 <a name="apiReference"></a> | |
357 <h2>API reference: chrome.devtools.inspectedWindow</h2> | |
358 <!-- PROPERTIES --> | |
359 <div class="apiGroup"> | |
360 <a name="properties"></a> | |
361 <h3 id="properties">Properties</h3> | |
362 <div> | |
363 <a name="property-tabId"></a> | |
364 <h4>tabId</h4> | |
365 <div class="summary"> | |
366 <!-- Note: intentionally longer 80 columns --> | |
367 <span>chrome.devtools.inspectedWindow.</span><span>tabId</span> | |
368 </div> | |
369 <div> | |
370 <dt> | |
371 <var>tabId</var> | |
372 <em> | |
373 <!-- TYPE --> | |
374 <div style="display:inline"> | |
375 ( | |
376 <span id="typeTemplate"> | |
377 <span> | |
378 <span>integer</span> | |
379 </span> | |
380 </span> | |
381 ) | |
382 </div> | |
383 </em> | |
384 </dt> | |
385 <dd>The ID of the tab being inspected. This ID may be used with chrome
.tabs.* API.</dd> | |
386 <!-- OBJECT PROPERTIES --> | |
387 <!-- OBJECT METHODS --> | |
388 <!-- OBJECT EVENT FIELDS --> | |
389 <!-- FUNCTION PARAMETERS --> | |
390 </div> | |
391 </div> | |
392 </div> <!-- /apiGroup --> | |
393 <!-- METHODS --> | |
394 <div id="methodsTemplate" class="apiGroup"> | |
395 <a name="global-methods"></a> | |
396 <h3>Methods</h3> | |
397 <!-- iterates over all functions --> | |
398 <div class="apiItem"> | |
399 <a name="method-eval"></a> <!-- method-anchor --> | |
400 <h4>eval</h4> | |
401 <div class="summary"> | |
402 <!-- Note: intentionally longer 80 columns --> | |
403 <span>chrome.devtools.inspectedWindow.eval</span>(<span class=
"null"><span>string</span> | |
404 <var><span>expression</span></var></span><span class="opti
onal"><span>, </span><span>function</span> | |
405 <var><span>callback</span></var></span>)</div> | |
406 <div class="description"> | |
407 <p>Evaluates a JavaScript expression in the context of the main
frame of the inspected page. The expression must evaluate to a JSON-compliant ob
ject, otherwise an exception is thrown.</p> | |
408 <!-- PARAMETERS --> | |
409 <h4>Parameters</h4> | |
410 <dl> | |
411 <div> | |
412 <div> | |
413 <dt> | |
414 <var>expression</var> | |
415 <em> | |
416 <!-- TYPE --> | |
417 <div style="display:inline"> | |
418 ( | |
419 <span id="typeTemplate"> | |
420 <span> | |
421 <span>string</span> | |
422 </span> | |
423 </span> | |
424 ) | |
425 </div> | |
426 </em> | |
427 </dt> | |
428 <dd>An expression to evaluate.</dd> | |
429 <!-- OBJECT PROPERTIES --> | |
430 <!-- OBJECT METHODS --> | |
431 <!-- OBJECT EVENT FIELDS --> | |
432 <!-- FUNCTION PARAMETERS --> | |
433 </div> | |
434 </div><div> | |
435 <div> | |
436 <dt> | |
437 <var>callback</var> | |
438 <em> | |
439 <!-- TYPE --> | |
440 <div style="display:inline"> | |
441 ( | |
442 <span class="optional">optional</span> | |
443 <span id="typeTemplate"> | |
444 <span> | |
445 <span>function</span> | |
446 </span> | |
447 </span> | |
448 ) | |
449 </div> | |
450 </em> | |
451 </dt> | |
452 <dd>A function called when evaluation completes.</dd> | |
453 <!-- OBJECT PROPERTIES --> | |
454 <!-- OBJECT METHODS --> | |
455 <!-- OBJECT EVENT FIELDS --> | |
456 <!-- FUNCTION PARAMETERS --> | |
457 </div> | |
458 </div> | |
459 </dl> | |
460 <!-- RETURNS --> | |
461 <dl> | |
462 </dl> | |
463 <!-- CALLBACK --> | |
464 <div> | |
465 <div> | |
466 <h4>Callback function</h4> | |
467 <p> | |
468 If you specify the <em>callback</em> parameter, it should | |
469 specify a function that looks like this: | |
470 </p> | |
471 <!-- Note: intentionally longer 80 columns --> | |
472 <pre>function(<span>object result, boolean isException</span>)
<span class="subdued">{...}</span>;</pre> | |
473 <dl> | |
474 <div> | |
475 <div> | |
476 <dt> | |
477 <var>result</var> | |
478 <em> | |
479 <!-- TYPE --> | |
480 <div style="display:inline"> | |
481 ( | |
482 <span id="typeTemplate"> | |
483 <span> | |
484 <span>object</span> | |
485 </span> | |
486 </span> | |
487 ) | |
488 </div> | |
489 </em> | |
490 </dt> | |
491 <dd>The result of evaluation.</dd> | |
492 <!-- OBJECT PROPERTIES --> | |
493 <!-- OBJECT METHODS --> | |
494 <!-- OBJECT EVENT FIELDS --> | |
495 <!-- FUNCTION PARAMETERS --> | |
496 </div> | |
497 </div><div> | |
498 <div> | |
499 <dt> | |
500 <var>isException</var> | |
501 <em> | |
502 <!-- TYPE --> | |
503 <div style="display:inline"> | |
504 ( | |
505 <span id="typeTemplate"> | |
506 <span> | |
507 <span>boolean</span> | |
508 </span> | |
509 </span> | |
510 ) | |
511 </div> | |
512 </em> | |
513 </dt> | |
514 <dd>Set if an exception was caught while evaluating the expression.</d
d> | |
515 <!-- OBJECT PROPERTIES --> | |
516 <!-- OBJECT METHODS --> | |
517 <!-- OBJECT EVENT FIELDS --> | |
518 <!-- FUNCTION PARAMETERS --> | |
519 </div> | |
520 </div> | |
521 </dl> | |
522 </div> | |
523 </div> | |
524 <!-- MIN_VERSION --> | |
525 </div> <!-- /description --> | |
526 </div><div class="apiItem"> | |
527 <a name="method-getResources"></a> <!-- method-anchor --> | |
528 <h4>getResources</h4> | |
529 <div class="summary"> | |
530 <!-- Note: intentionally longer 80 columns --> | |
531 <span>chrome.devtools.inspectedWindow.getResources</span>(<spa
n class="null"><span>function</span> | |
532 <var><span>callback</span></var></span>)</div> | |
533 <div class="description"> | |
534 <p>Retrieves the list of resources from the inspected page.</p> | |
535 <!-- PARAMETERS --> | |
536 <h4>Parameters</h4> | |
537 <dl> | |
538 <div> | |
539 <div> | |
540 <dt> | |
541 <var>callback</var> | |
542 <em> | |
543 <!-- TYPE --> | |
544 <div style="display:inline"> | |
545 ( | |
546 <span id="typeTemplate"> | |
547 <span> | |
548 <span>function</span> | |
549 </span> | |
550 </span> | |
551 ) | |
552 </div> | |
553 </em> | |
554 </dt> | |
555 <dd>A function that receives the list of resources when the request co
mpletes.</dd> | |
556 <!-- OBJECT PROPERTIES --> | |
557 <!-- OBJECT METHODS --> | |
558 <!-- OBJECT EVENT FIELDS --> | |
559 <!-- FUNCTION PARAMETERS --> | |
560 </div> | |
561 </div> | |
562 </dl> | |
563 <!-- RETURNS --> | |
564 <dl> | |
565 </dl> | |
566 <!-- CALLBACK --> | |
567 <div> | |
568 <div> | |
569 <h4>Callback function</h4> | |
570 <p> | |
571 The <em>callback</em> parameter should specify a function | |
572 that looks like this: | |
573 </p> | |
574 <!-- Note: intentionally longer 80 columns --> | |
575 <pre>function(<span>array of Resource resources</span>) <span
class="subdued">{...}</span>;</pre> | |
576 <dl> | |
577 <div> | |
578 <div> | |
579 <dt> | |
580 <var>resources</var> | |
581 <em> | |
582 <!-- TYPE --> | |
583 <div style="display:inline"> | |
584 ( | |
585 <span id="typeTemplate"> | |
586 <span> | |
587 <span> | |
588 array of <span><span> | |
589 <span> | |
590 <a href="devtools.inspectedWindow.html#type-Resource">Re
source</a> | |
591 </span> | |
592 </span></span> | |
593 </span> | |
594 </span> | |
595 </span> | |
596 ) | |
597 </div> | |
598 </em> | |
599 </dt> | |
600 <dd>The resources within the page.</dd> | |
601 <!-- OBJECT PROPERTIES --> | |
602 <!-- OBJECT METHODS --> | |
603 <!-- OBJECT EVENT FIELDS --> | |
604 <!-- FUNCTION PARAMETERS --> | |
605 </div> | |
606 </div> | |
607 </dl> | |
608 </div> | |
609 </div> | |
610 <!-- MIN_VERSION --> | |
611 </div> <!-- /description --> | |
612 </div><div class="apiItem"> | |
613 <a name="method-reload"></a> <!-- method-anchor --> | |
614 <h4>reload</h4> | |
615 <div class="summary"> | |
616 <!-- Note: intentionally longer 80 columns --> | |
617 <span>chrome.devtools.inspectedWindow.reload</span>(<span clas
s="optional"><span>object</span> | |
618 <var><span>reloadOptions</span></var></span>)</div> | |
619 <div class="description"> | |
620 <p>Reloads the inspected page.</p> | |
621 <!-- PARAMETERS --> | |
622 <h4>Parameters</h4> | |
623 <dl> | |
624 <div> | |
625 <div> | |
626 <dt> | |
627 <var>reloadOptions</var> | |
628 <em> | |
629 <!-- TYPE --> | |
630 <div style="display:inline"> | |
631 ( | |
632 <span class="optional">optional</span> | |
633 <span id="typeTemplate"> | |
634 <span> | |
635 <span>object</span> | |
636 </span> | |
637 </span> | |
638 ) | |
639 </div> | |
640 </em> | |
641 </dt> | |
642 <dd class="todo"> | |
643 Undocumented. | |
644 </dd> | |
645 <!-- OBJECT PROPERTIES --> | |
646 <dd> | |
647 <dl> | |
648 <div> | |
649 <div> | |
650 <dt> | |
651 <var>ignoreCache</var> | |
652 <em> | |
653 <!-- TYPE --> | |
654 <div style="display:inline"> | |
655 ( | |
656 <span class="optional">optional</span> | |
657 <span id="typeTemplate"> | |
658 <span> | |
659 <span>boolean</span> | |
660 </span> | |
661 </span> | |
662 ) | |
663 </div> | |
664 </em> | |
665 </dt> | |
666 <dd>When true, the loader will ignore the cache for all inspected page
resources loaded before the <code>load</code> event is fired. The effect is sim
ilar to pressing Ctrl+Shift+R in the inspected window or within the Developer To
ols window.</dd> | |
667 <!-- OBJECT PROPERTIES --> | |
668 <!-- OBJECT METHODS --> | |
669 <!-- OBJECT EVENT FIELDS --> | |
670 <!-- FUNCTION PARAMETERS --> | |
671 </div> | |
672 </div><div> | |
673 <div> | |
674 <dt> | |
675 <var>userAgent</var> | |
676 <em> | |
677 <!-- TYPE --> | |
678 <div style="display:inline"> | |
679 ( | |
680 <span class="optional">optional</span> | |
681 <span id="typeTemplate"> | |
682 <span> | |
683 <span>string</span> | |
684 </span> | |
685 </span> | |
686 ) | |
687 </div> | |
688 </em> | |
689 </dt> | |
690 <dd>If specified, the string will override the value of the <code>User
-Agent</code> HTTP header that's sent while loading the resources of the inspect
ed page. The string will also override the value of the <code>navigator.userAgen
t</code> property that's returned to any scripts that are running within the ins
pected page.</dd> | |
691 <!-- OBJECT PROPERTIES --> | |
692 <!-- OBJECT METHODS --> | |
693 <!-- OBJECT EVENT FIELDS --> | |
694 <!-- FUNCTION PARAMETERS --> | |
695 </div> | |
696 </div><div> | |
697 <div> | |
698 <dt> | |
699 <var>injectedScript</var> | |
700 <em> | |
701 <!-- TYPE --> | |
702 <div style="display:inline"> | |
703 ( | |
704 <span class="optional">optional</span> | |
705 <span id="typeTemplate"> | |
706 <span> | |
707 <span>string</span> | |
708 </span> | |
709 </span> | |
710 ) | |
711 </div> | |
712 </em> | |
713 </dt> | |
714 <dd>If specified, the script will be injected into every frame of the
inspected page immediately upon load, before any of the frame's scripts. The scr
ipt will not be injected after subsequent reloads—for example, if the user press
es Ctrl+R.</dd> | |
715 <!-- OBJECT PROPERTIES --> | |
716 <!-- OBJECT METHODS --> | |
717 <!-- OBJECT EVENT FIELDS --> | |
718 <!-- FUNCTION PARAMETERS --> | |
719 </div> | |
720 </div> | |
721 </dl> | |
722 </dd> | |
723 <!-- OBJECT METHODS --> | |
724 <!-- OBJECT EVENT FIELDS --> | |
725 <!-- FUNCTION PARAMETERS --> | |
726 </div> | |
727 </div> | |
728 </dl> | |
729 <!-- RETURNS --> | |
730 <dl> | |
731 </dl> | |
732 <!-- CALLBACK --> | |
733 <!-- MIN_VERSION --> | |
734 </div> <!-- /description --> | |
735 </div> <!-- /apiItem --> | |
736 </div> <!-- /apiGroup --> | |
737 <!-- EVENTS --> | |
738 <div id="eventsTemplate" class="apiGroup"> | |
739 <a name="global-events"></a> | |
740 <h3>Events</h3> | |
741 <!-- iterates over all events --> | |
742 <div class="apiItem"> | |
743 <a name="event-onResourceAdded"></a> | |
744 <h4>onResourceAdded</h4> | |
745 <div class="summary"> | |
746 <!-- Note: intentionally longer 80 columns --> | |
747 <span class="subdued">chrome.devtools.inspectedWindow.</span><sp
an>onResourceAdded</span><span class="subdued">.addListener</span>(function(<spa
n>Resource resource</span>) <span class="subdued">{...}</span><span></span>); | |
748 </div> | |
749 <div class="description"> | |
750 <p>Fired when a new resource is added to the inspected page.</p> | |
751 <!-- LISTENER PARAMETERS --> | |
752 <div> | |
753 <h4>Listener parameters</h4> | |
754 <dl> | |
755 <div> | |
756 <div> | |
757 <dt> | |
758 <var>resource</var> | |
759 <em> | |
760 <!-- TYPE --> | |
761 <div style="display:inline"> | |
762 ( | |
763 <span id="typeTemplate"> | |
764 <span> | |
765 <a href="devtools.inspectedWindow.html#type-Resource">Re
source</a> | |
766 </span> | |
767 </span> | |
768 ) | |
769 </div> | |
770 </em> | |
771 </dt> | |
772 <dd class="todo"> | |
773 Undocumented. | |
774 </dd> | |
775 <!-- OBJECT PROPERTIES --> | |
776 <!-- OBJECT METHODS --> | |
777 <!-- OBJECT EVENT FIELDS --> | |
778 <!-- FUNCTION PARAMETERS --> | |
779 </div> | |
780 </div> | |
781 </dl> | |
782 </div> | |
783 <!-- EXTRA PARAMETERS --> | |
784 <!-- LISTENER RETURN VALUE --> | |
785 <dl> | |
786 </dl> | |
787 </div> <!-- /description --> | |
788 <!-- /description --> | |
789 </div><div class="apiItem"> | |
790 <a name="event-onResourceContentCommitted"></a> | |
791 <h4>onResourceContentCommitted</h4> | |
792 <div class="summary"> | |
793 <!-- Note: intentionally longer 80 columns --> | |
794 <span class="subdued">chrome.devtools.inspectedWindow.</span><sp
an>onResourceContentCommitted</span><span class="subdued">.addListener</span>(fu
nction(<span>Resource resource, string content</span>) <span class="subdued">{..
.}</span><span></span>); | |
795 </div> | |
796 <div class="description"> | |
797 <p>Fired when a new revision of the resource is committed (e.g.
user saves an edited version of the resource in the Developer Tools).</p> | |
798 <!-- LISTENER PARAMETERS --> | |
799 <div> | |
800 <h4>Listener parameters</h4> | |
801 <dl> | |
802 <div> | |
803 <div> | |
804 <dt> | |
805 <var>resource</var> | |
806 <em> | |
807 <!-- TYPE --> | |
808 <div style="display:inline"> | |
809 ( | |
810 <span id="typeTemplate"> | |
811 <span> | |
812 <a href="devtools.inspectedWindow.html#type-Resource">Re
source</a> | |
813 </span> | |
814 </span> | |
815 ) | |
816 </div> | |
817 </em> | |
818 </dt> | |
819 <dd class="todo"> | |
820 Undocumented. | |
821 </dd> | |
822 <!-- OBJECT PROPERTIES --> | |
823 <!-- OBJECT METHODS --> | |
824 <!-- OBJECT EVENT FIELDS --> | |
825 <!-- FUNCTION PARAMETERS --> | |
826 </div> | |
827 </div><div> | |
828 <div> | |
829 <dt> | |
830 <var>content</var> | |
831 <em> | |
832 <!-- TYPE --> | |
833 <div style="display:inline"> | |
834 ( | |
835 <span id="typeTemplate"> | |
836 <span> | |
837 <span>string</span> | |
838 </span> | |
839 </span> | |
840 ) | |
841 </div> | |
842 </em> | |
843 </dt> | |
844 <dd>New content of the resource.</dd> | |
845 <!-- OBJECT PROPERTIES --> | |
846 <!-- OBJECT METHODS --> | |
847 <!-- OBJECT EVENT FIELDS --> | |
848 <!-- FUNCTION PARAMETERS --> | |
849 </div> | |
850 </div> | |
851 </dl> | |
852 </div> | |
853 <!-- EXTRA PARAMETERS --> | |
854 <!-- LISTENER RETURN VALUE --> | |
855 <dl> | |
856 </dl> | |
857 </div> <!-- /description --> | |
858 <!-- /description --> | |
859 </div> <!-- /apiItem --> | |
860 </div> <!-- /apiGroup --> | |
861 <!-- TYPES --> | |
862 <div class="apiGroup"> | |
863 <a name="types"></a> | |
864 <h3 id="types">Types</h3> | |
865 <!-- iterates over all types --> | |
866 <div class="apiItem"> | |
867 <a name="type-Resource"></a> | |
868 <h4>Resource</h4> | |
869 <div> | |
870 <dt> | |
871 <em> | |
872 <!-- TYPE --> | |
873 <div style="display:inline"> | |
874 ( | |
875 <span id="typeTemplate"> | |
876 <span> | |
877 <span>object</span> | |
878 </span> | |
879 </span> | |
880 ) | |
881 </div> | |
882 </em> | |
883 </dt> | |
884 <dd>A resource within the inspected page, such as a document, a script
, or an image.</dd> | |
885 <!-- OBJECT PROPERTIES --> | |
886 <dd> | |
887 <dl> | |
888 <div> | |
889 <div> | |
890 <dt> | |
891 <var>url</var> | |
892 <em> | |
893 <!-- TYPE --> | |
894 <div style="display:inline"> | |
895 ( | |
896 <span id="typeTemplate"> | |
897 <span> | |
898 <span>string</span> | |
899 </span> | |
900 </span> | |
901 ) | |
902 </div> | |
903 </em> | |
904 </dt> | |
905 <dd>The URL of the resource.</dd> | |
906 <!-- OBJECT PROPERTIES --> | |
907 <!-- OBJECT METHODS --> | |
908 <!-- OBJECT EVENT FIELDS --> | |
909 <!-- FUNCTION PARAMETERS --> | |
910 </div> | |
911 </div> | |
912 </dl> | |
913 </dd> | |
914 <!-- OBJECT METHODS --> | |
915 <dd> | |
916 <div class="apiGroup"> | |
917 <a name="global-Resource-methods"></a> | |
918 <h3>Methods of Resource</h3> | |
919 <!-- iterates over all functions --> | |
920 <div class="apiItem"> | |
921 <a name="method-Resource-getContent"></a> <!-- method-anchor --> | |
922 <h4>getContent</h4> | |
923 <div class="summary"> | |
924 <!-- Note: intentionally longer 80 columns --> | |
925 <span>resource.getContent</span>(<span class="null"><span>func
tion</span> | |
926 <var><span>callback</span></var></span>)</div> | |
927 <div class="description"> | |
928 <p>Gets the content of the resource.</p> | |
929 <!-- PARAMETERS --> | |
930 <h4>Parameters</h4> | |
931 <dl> | |
932 <div> | |
933 <div> | |
934 <dt> | |
935 <var>callback</var> | |
936 <em> | |
937 <!-- TYPE --> | |
938 <div style="display:inline"> | |
939 ( | |
940 <span id="typeTemplate"> | |
941 <span> | |
942 <span>function</span> | |
943 </span> | |
944 </span> | |
945 ) | |
946 </div> | |
947 </em> | |
948 </dt> | |
949 <dd>A function that receives resource content when the request complet
es.</dd> | |
950 <!-- OBJECT PROPERTIES --> | |
951 <!-- OBJECT METHODS --> | |
952 <!-- OBJECT EVENT FIELDS --> | |
953 <!-- FUNCTION PARAMETERS --> | |
954 </div> | |
955 </div> | |
956 </dl> | |
957 <!-- RETURNS --> | |
958 <dl> | |
959 </dl> | |
960 <!-- CALLBACK --> | |
961 <div> | |
962 <div> | |
963 <h4>Callback function</h4> | |
964 <p> | |
965 The <em>callback</em> parameter should specify a function | |
966 that looks like this: | |
967 </p> | |
968 <!-- Note: intentionally longer 80 columns --> | |
969 <pre>function(<span>string content, string encoding</span>) <s
pan class="subdued">{...}</span>;</pre> | |
970 <dl> | |
971 <div> | |
972 <div> | |
973 <dt> | |
974 <var>content</var> | |
975 <em> | |
976 <!-- TYPE --> | |
977 <div style="display:inline"> | |
978 ( | |
979 <span id="typeTemplate"> | |
980 <span> | |
981 <span>string</span> | |
982 </span> | |
983 </span> | |
984 ) | |
985 </div> | |
986 </em> | |
987 </dt> | |
988 <dd>Content of the resource (potentially encoded).</dd> | |
989 <!-- OBJECT PROPERTIES --> | |
990 <!-- OBJECT METHODS --> | |
991 <!-- OBJECT EVENT FIELDS --> | |
992 <!-- FUNCTION PARAMETERS --> | |
993 </div> | |
994 </div><div> | |
995 <div> | |
996 <dt> | |
997 <var>encoding</var> | |
998 <em> | |
999 <!-- TYPE --> | |
1000 <div style="display:inline"> | |
1001 ( | |
1002 <span id="typeTemplate"> | |
1003 <span> | |
1004 <span>string</span> | |
1005 </span> | |
1006 </span> | |
1007 ) | |
1008 </div> | |
1009 </em> | |
1010 </dt> | |
1011 <dd>Empty if content is not encoded, encoding name otherwise. Currentl
y, only base64 is supported.</dd> | |
1012 <!-- OBJECT PROPERTIES --> | |
1013 <!-- OBJECT METHODS --> | |
1014 <!-- OBJECT EVENT FIELDS --> | |
1015 <!-- FUNCTION PARAMETERS --> | |
1016 </div> | |
1017 </div> | |
1018 </dl> | |
1019 </div> | |
1020 </div> | |
1021 <!-- MIN_VERSION --> | |
1022 </div> <!-- /description --> | |
1023 </div><div class="apiItem"> | |
1024 <a name="method-Resource-setContent"></a> <!-- method-anchor --> | |
1025 <h4>setContent</h4> | |
1026 <div class="summary"> | |
1027 <!-- Note: intentionally longer 80 columns --> | |
1028 <span>resource.setContent</span>(<span class="null"><span>stri
ng</span> | |
1029 <var><span>content</span></var></span><span class="null"><
span>, </span><span>boolean</span> | |
1030 <var><span>commit</span></var></span><span class="optional
"><span>, </span><span>function</span> | |
1031 <var><span>callback</span></var></span>)</div> | |
1032 <div class="description"> | |
1033 <p>Sets the content of the resource.</p> | |
1034 <!-- PARAMETERS --> | |
1035 <h4>Parameters</h4> | |
1036 <dl> | |
1037 <div> | |
1038 <div> | |
1039 <dt> | |
1040 <var>content</var> | |
1041 <em> | |
1042 <!-- TYPE --> | |
1043 <div style="display:inline"> | |
1044 ( | |
1045 <span id="typeTemplate"> | |
1046 <span> | |
1047 <span>string</span> | |
1048 </span> | |
1049 </span> | |
1050 ) | |
1051 </div> | |
1052 </em> | |
1053 </dt> | |
1054 <dd>New content of the resource. Only resources with the text type are
currently supported.</dd> | |
1055 <!-- OBJECT PROPERTIES --> | |
1056 <!-- OBJECT METHODS --> | |
1057 <!-- OBJECT EVENT FIELDS --> | |
1058 <!-- FUNCTION PARAMETERS --> | |
1059 </div> | |
1060 </div><div> | |
1061 <div> | |
1062 <dt> | |
1063 <var>commit</var> | |
1064 <em> | |
1065 <!-- TYPE --> | |
1066 <div style="display:inline"> | |
1067 ( | |
1068 <span id="typeTemplate"> | |
1069 <span> | |
1070 <span>boolean</span> | |
1071 </span> | |
1072 </span> | |
1073 ) | |
1074 </div> | |
1075 </em> | |
1076 </dt> | |
1077 <dd>True if the user has finished editing the resource, and the new co
ntent of the resource should be persisted; false if this is a minor change sent
in progress of the user editing the resource.</dd> | |
1078 <!-- OBJECT PROPERTIES --> | |
1079 <!-- OBJECT METHODS --> | |
1080 <!-- OBJECT EVENT FIELDS --> | |
1081 <!-- FUNCTION PARAMETERS --> | |
1082 </div> | |
1083 </div><div> | |
1084 <div> | |
1085 <dt> | |
1086 <var>callback</var> | |
1087 <em> | |
1088 <!-- TYPE --> | |
1089 <div style="display:inline"> | |
1090 ( | |
1091 <span class="optional">optional</span> | |
1092 <span id="typeTemplate"> | |
1093 <span> | |
1094 <span>function</span> | |
1095 </span> | |
1096 </span> | |
1097 ) | |
1098 </div> | |
1099 </em> | |
1100 </dt> | |
1101 <dd>A function called upon request completion.</dd> | |
1102 <!-- OBJECT PROPERTIES --> | |
1103 <!-- OBJECT METHODS --> | |
1104 <!-- OBJECT EVENT FIELDS --> | |
1105 <!-- FUNCTION PARAMETERS --> | |
1106 </div> | |
1107 </div> | |
1108 </dl> | |
1109 <!-- RETURNS --> | |
1110 <dl> | |
1111 </dl> | |
1112 <!-- CALLBACK --> | |
1113 <div> | |
1114 <div> | |
1115 <h4>Callback function</h4> | |
1116 <p> | |
1117 If you specify the <em>callback</em> parameter, it should | |
1118 specify a function that looks like this: | |
1119 </p> | |
1120 <!-- Note: intentionally longer 80 columns --> | |
1121 <pre>function(<span>object error</span>) <span class="subdued"
>{...}</span>;</pre> | |
1122 <dl> | |
1123 <div> | |
1124 <div> | |
1125 <dt> | |
1126 <var>error</var> | |
1127 <em> | |
1128 <!-- TYPE --> | |
1129 <div style="display:inline"> | |
1130 ( | |
1131 <span class="optional">optional</span> | |
1132 <span id="typeTemplate"> | |
1133 <span> | |
1134 <span>object</span> | |
1135 </span> | |
1136 </span> | |
1137 ) | |
1138 </div> | |
1139 </em> | |
1140 </dt> | |
1141 <dd>Set to undefined if the resource content was set successfully; des
cribes error otherwise.</dd> | |
1142 <!-- OBJECT PROPERTIES --> | |
1143 <!-- OBJECT METHODS --> | |
1144 <!-- OBJECT EVENT FIELDS --> | |
1145 <!-- FUNCTION PARAMETERS --> | |
1146 </div> | |
1147 </div> | |
1148 </dl> | |
1149 </div> | |
1150 </div> | |
1151 <!-- MIN_VERSION --> | |
1152 </div> <!-- /description --> | |
1153 </div> <!-- /apiItem --> | |
1154 </div> | |
1155 </dd> | |
1156 <!-- OBJECT EVENT FIELDS --> | |
1157 <!-- FUNCTION PARAMETERS --> | |
1158 </div> | |
1159 </div> <!-- /apiItem --> | |
1160 </div> <!-- /apiGroup --> | |
1161 </div> <!-- /apiPage --> | |
1162 </div> <!-- /gc-pagecontent --> | |
1163 </div> <!-- /g-section --> | |
1164 </div> <!-- /codesiteContent --> | |
1165 <div id="gc-footer" --=""> | |
1166 <div class="text"> | |
1167 <p> | |
1168 Except as otherwise <a href="http://code.google.com/policies.html#restrictions
">noted</a>, | |
1169 the content of this page is licensed under the <a rel="license" href="http://c
reativecommons.org/licenses/by/3.0/">Creative Commons | |
1170 Attribution 3.0 License</a>, and code samples are licensed under the | |
1171 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic
ense</a>. | |
1172 </p> | |
1173 <p> | |
1174 ©2011 Google | |
1175 </p> | |
1176 <!-- begin analytics --> | |
1177 <script src="https://www.google-analytics.com/urchin.js" type="text/javascript">
</script> | |
1178 <script src="https://www.google-analytics.com/ga.js" type="text/javascript"></sc
ript> | |
1179 <script type="text/javascript"> | |
1180 // chrome doc tracking | |
1181 try { | |
1182 var engdocs = _gat._getTracker("YT-10763712-2"); | |
1183 engdocs._trackPageview(); | |
1184 } catch(err) {} | |
1185 // code.google.com site-wide tracking | |
1186 try { | |
1187 _uacct="UA-18071-1"; | |
1188 _uanchor=1; | |
1189 _uff=0; | |
1190 urchinTracker(); | |
1191 } | |
1192 catch(e) {/* urchinTracker not available. */} | |
1193 </script> | |
1194 <!-- end analytics --> | |
1195 </div> | |
1196 </div> <!-- /gc-footer --> | |
1197 </div> <!-- /gc-container --> | |
1198 </body></html> | |
OLD | NEW |