diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-02 00:57:23 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-02 00:57:23 +0000 |
commit | b26c549956d09d3756c51c29e02dd9dd43705ed7 (patch) | |
tree | bc0d4efda30b5a778d6f84b0e5e9e11f5e0e5240 /chrome/common/extensions/docs/static/content_scripts.html | |
parent | 261e60d51c33dfa14a225203bb7cfe0dc0ec88a2 (diff) | |
download | chromium_src-b26c549956d09d3756c51c29e02dd9dd43705ed7.zip chromium_src-b26c549956d09d3756c51c29e02dd9dd43705ed7.tar.gz chromium_src-b26c549956d09d3756c51c29e02dd9dd43705ed7.tar.bz2 |
Content script docs nitpickery.
TBR=rafaelw@chromium.org,kathyw@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25137 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/docs/static/content_scripts.html')
-rw-r--r-- | chrome/common/extensions/docs/static/content_scripts.html | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/chrome/common/extensions/docs/static/content_scripts.html b/chrome/common/extensions/docs/static/content_scripts.html index 52e3558..6013133 100644 --- a/chrome/common/extensions/docs/static/content_scripts.html +++ b/chrome/common/extensions/docs/static/content_scripts.html @@ -63,7 +63,7 @@ </table> -<h2 id="execution_environment">Execution environment</h2> +<h2 id="extecution-environment">Execution environment</h2> <p>Content scripts execute in a special environment called an <em>isolated world</em>. They have access to the DOM of the page they are injected into, but not to any JavaScript variables or functions created by the page. It looks to each content script as if there is no other JavaScript executing on the page it is running on. The same is true in reverse: JavaScript running on the page cannot call any functions or access any variables defined by content scripts. @@ -101,9 +101,9 @@ document.getElementById("button").onclick = function() { <h2 id="messaging">Messaging</h2> -<p>Content scripts can communicate with their parent extension using message passing. A message channel can be opened by either the content script or an extension page. Each side of the channel has a <a href="extension.html#port">Port</a> object which can be used to send messages to the other side. The messages can contain any valid JSON object (null, boolean, number, string, array, or object). +<p>Content scripts can communicate with their parent extension using message passing. A message channel can be opened by either the content script or an extension page. Each side of the channel has a <a href="extension.html#type-Port">Port</a> object which can be used to send messages to the other side. The messages can contain any valid JSON object (null, boolean, number, string, array, or object). -<p>The content script opens a channel to the extension using the <a href="extension.html#connect">chrome.extension.connect()</a> method. The parent extension can also open a channel to a content script in a given tab by calling <a href="tabs.html#connect">chrome.tabs.connect(tabId)</a>. In either case, the <a href="extension.html#onConnect">onConnect</a> event is fired in the targeted page(s), and a connection is established. +<p>The content script opens a channel to the extension using the <a href="extension.html#method-connect">chrome.extension.connect()</a> method. The parent extension can also open a channel to a content script in a given tab by calling <a href="tabs.html#method-connect">chrome.tabs.connect(tabId)</a>. In either case, the <a href="extension.html#event-onConnect">onConnect</a> event is fired in the targeted page(s), and a connection is established. <p>When a channel is opened from a content script to an extension, the event is fired in all views in the extension. Any view can receive the event. @@ -162,7 +162,7 @@ function onClick() { </script> </pre> -<h2 id="hostPageCommuncation">Communication with the embedding page</h2> +<h2 id="host-page-communication">Communication with the embedding page</h2> <p>Although the execution environments of content scripts and the pages that host them are isolated from each other, they share access to the page's DOM. If the page wishes to communicate with the content script (or with the extension via the content script), it must do so through the shared DOM.</p> @@ -190,7 +190,7 @@ document.getElementById('myCustomEventDiv').addEventListener('myCustomEvent', fu <p>In the above example, example.html (which is not a part of the extension) creates a custom event and then can decide to fire the event by setting the event data to a known location in the DOM and then dispatching the custom event. The content script listens for the name of the custom event on the known element and handles the event by inspecting the data of the element, and turning around to post the message to the extension process. In this way the page establishes a line of communication to the extension. The reverse is possible through similar means.</p> -<h2 id="extensionFiles">Referring to extension files</h2> +<h2 id="extension-files">Referring to extension files</h2> <p> Get the URL of an extension's file using |