| Index: chrome/common/extensions/docs/templates/articles/content_scripts.html
|
| diff --git a/chrome/common/extensions/docs/templates/articles/content_scripts.html b/chrome/common/extensions/docs/templates/articles/content_scripts.html
|
| index c6a18098fb0df9baab358baf3f3463eb8a1cce55..dba074a4cc43dc55cfc4eed6f21e833e2002c04d 100644
|
| --- a/chrome/common/extensions/docs/templates/articles/content_scripts.html
|
| +++ b/chrome/common/extensions/docs/templates/articles/content_scripts.html
|
| @@ -29,7 +29,7 @@ They <b>cannot</b>:
|
| <li>
|
| Use chrome.* APIs
|
| (except for parts of
|
| - <a href="extension.html"><code>chrome.extension</code></a>)
|
| + <a href="extension"><code>chrome.extension</code></a>)
|
| </li>
|
| <li>
|
| Use variables or functions defined by their extension's pages
|
| @@ -44,10 +44,10 @@ These limitations aren't as bad as they sound.
|
| Content scripts can <em>indirectly</em> use the chrome.* APIs,
|
| get access to extension data,
|
| and request extension actions
|
| -by exchanging <a href="messaging.html">messages</a>
|
| +by exchanging <a href="messaging">messages</a>
|
| with their parent extension.
|
| Content scripts can also
|
| -make <a href="xhr.html">cross-site XMLHttpRequests</a>
|
| +make <a href="xhr">cross-site XMLHttpRequests</a>
|
| to the same sites as their parent extensions,
|
| and they can
|
| <a href="#host-page-communication">communicate with web pages</a>
|
| @@ -61,7 +61,7 @@ learn about the
|
|
|
| <p>If your content script's code should always be injected,
|
| register it in the
|
| -<a href="manifest.html">extension manifest</a>
|
| +<a href="manifest">extension manifest</a>
|
| using the <code>content_scripts</code> field,
|
| as in the following example.
|
| </p>
|
| @@ -84,7 +84,7 @@ as in the following example.
|
| <p>
|
| If you want to inject the code only sometimes,
|
| use the
|
| -<a href="declare_permissions.html"><code>permissions</code></a> field instead,
|
| +<a href="declare_permissions"><code>permissions</code></a> field instead,
|
| as described in <a href="#pi">Programmatic injection</a>.
|
| </p>
|
|
|
| @@ -117,7 +117,7 @@ can have the following properties:</p>
|
| <td>array of strings</td>
|
| <td><em>Required.</em>
|
| Specifies which pages this content script will be injected into.
|
| - See <a href="match_patterns.html">Match Patterns</a>
|
| + See <a href="match_patterns">Match Patterns</a>
|
| for more details on the syntax of these strings
|
| and <a href="#match-patterns-globs">Match patterns and globs</a>
|
| for information on how to exclude URLs.</td>
|
| @@ -128,7 +128,7 @@ can have the following properties:</p>
|
| <td><em>Optional.</em>
|
| Excludes pages that this content script would otherwise be
|
| injected into.
|
| - See <a href="match_patterns.html">Match Patterns</a>
|
| + See <a href="match_patterns">Match Patterns</a>
|
| for more details on the syntax of these strings
|
| and <a href="#match-patterns-globs">Match patterns and globs</a>
|
| for information on how to exclude URLs.</td>
|
| @@ -206,13 +206,13 @@ For example, assume <code>matches</code> is <code>["http://*.nytimes.com/*"]</co
|
| </p>
|
| <ul>
|
| <li>If <code>exclude_matches</code> is <code>["*://*/*business*"]</code>, then the content script would be injected into "http://www.nytimes.com/health" but not into "http://www.nytimes.com/business".</li>
|
| -<li>If <code>include_globs</code> is <code>["*nytimes.com/???s/*"]</code>, then the content script would be injected into "http:/www.nytimes.com/arts/index.html" and "http://www.nytimes.com/jobs/index.html" but not into "http://www.nytimes.com/sports/index.html".</li>
|
| +<li>If <code>include_globs</code> is <code>["*nytimes.com/???s/*"]</code>, then the content script would be injected into "http:/www.nytimes.com/arts/index" and "http://www.nytimes.com/jobs/index" but not into "http://www.nytimes.com/sports/index".</li>
|
| <li>If <code>exclude_globs</code> is <code>["*science*"]</code>, then the content script would be injected into "http://www.nytimes.com" but not into "http://science.nytimes.com" or "http://www.nytimes.com/science".</li>
|
| </ul>
|
| <p>
|
|
|
| <p>
|
| -Glob properties follow a different, more flexible syntax than <a href="match_patterns.html">match patterns</a>. Acceptable glob strings are URLs that may contain "wildcard" asterisks and question marks. The asterisk (*) matches any string of any length (including the empty string); the question mark (?) matches any single character.
|
| +Glob properties follow a different, more flexible syntax than <a href="match_patterns">match patterns</a>. Acceptable glob strings are URLs that may contain "wildcard" asterisks and question marks. The asterisk (*) matches any string of any length (including the empty string); the question mark (?) matches any single character.
|
| </p>
|
|
|
| <p>
|
| @@ -245,12 +245,12 @@ only when the user clicks a browser action's icon.
|
| <p>
|
| To insert code into a page,
|
| your extension must have
|
| -<a href="xhr.html#requesting-permission">cross-origin permissions</a>
|
| +<a href="xhr#requesting-permission">cross-origin permissions</a>
|
| for the page.
|
| It also must be able to use the <code>chrome.tabs</code> module.
|
| You can get both kinds of permission
|
| using the manifest file's
|
| -<a href="declare_permissions.html">permissions</a> field.
|
| +<a href="declare_permissions">permissions</a> field.
|
| </p>
|
|
|
| <p>
|
| @@ -270,7 +270,7 @@ by inserting JavaScript into the current tab's page
|
| and executing the script.
|
| </p>
|
|
|
| -<pre data-filename="background.html">
|
| +<pre data-filename="background">
|
| chrome.browserAction.onClicked.addListener(function(tab) {
|
| chrome.tabs.executeScript({
|
| code: 'document.body.style.backgroundColor="red"'
|
| @@ -307,7 +307,7 @@ You inject the file's contents like this:
|
|
|
| <p>For example, consider this simple page:
|
|
|
| -<pre data-filename="hello.html">
|
| +<pre data-filename="hello">
|
| <html>
|
| <button id="mybutton">click me</button>
|
| <script>
|
| @@ -321,7 +321,7 @@ You inject the file's contents like this:
|
| </html>
|
| </pre>
|
|
|
| -<p>Now, suppose this content script was injected into hello.html:
|
| +<p>Now, suppose this content script was injected into hello:
|
|
|
| <pre data-filename="contentscript.js">
|
| var greeting = "hola, ";
|
| @@ -358,12 +358,12 @@ window.addEventListener("message", function(event) {
|
| }
|
| }, false);
|
| </pre>
|
| -<pre data-filename="http://foo.com/example.html">
|
| +<pre data-filename="http://foo.com/example">
|
| document.getElementById("theButton").addEventListener("click",
|
| function() {
|
| window.postMessage({ type: "FROM_PAGE", text: "Hello from the webpage!" }, "*");
|
| }, false);</pre>
|
| -<p>In the above example, example.html (which is not a part of the extension) posts messages to itself, which are intercepted and inspected by the content script, and then posted to the extension process. In this way, the page establishes a line of communication to the extension process. The reverse is possible through similar means.</p>
|
| +<p>In the above example, example (which is not a part of the extension) posts messages to itself, which are intercepted and inspected by the content script, and then posted to the extension process. In this way, the page establishes a line of communication to the extension process. The reverse is possible through similar means.</p>
|
|
|
| <h2 id="security-considerations">Security considerations</h2>
|
|
|
| @@ -371,7 +371,7 @@ document.getElementById("theButton").addEventListener("click",
|
| First, be careful not to introduce security vulnerabilities into the web site
|
| your content script is injected into. For example, if your content script
|
| receives content from another web site (for example, by making an <a
|
| -href="xhr.html">XMLHttpRequest</a>),
|
| +href="xhr">XMLHttpRequest</a>),
|
| be careful to filter that content for <a
|
| href="http://en.wikipedia.org/wiki/Cross-site_scripting">cross-site
|
| scripting</a> attacks before injecting the content into the current page.
|
| @@ -430,11 +430,11 @@ document.getElementById("someImage").src = imgURL;
|
|
|
| <p>
|
| You can find many
|
| -<a href="samples.html#script">examples that use content scripts</a>.
|
| +<a href="samples#script">examples that use content scripts</a>.
|
| A simple example of communication via messages is in the
|
| -<a href="samples.html#message-timer">Message Timer</a>.
|
| -See <a href="samples.html#page-redder">Page Redder</a> and
|
| -<a href="samples.html#email-this-page-(by-google)">Email This Page</a>
|
| +<a href="samples#message-timer">Message Timer</a>.
|
| +See <a href="samples#page-redder">Page Redder</a> and
|
| +<a href="samples#email-this-page-(by-google)">Email This Page</a>
|
| for examples of programmatic injection.
|
| </p>
|
|
|
|
|