| Index: chrome/common/extensions/docs/static/content_scripts.html
|
| diff --git a/chrome/common/extensions/docs/static/content_scripts.html b/chrome/common/extensions/docs/static/content_scripts.html
|
| index 0c5bcd984bf693b265633304140ae70b46f6d9cf..cddf395c0fc34f87c7f8ba256f4c344072456663 100644
|
| --- a/chrome/common/extensions/docs/static/content_scripts.html
|
| +++ b/chrome/common/extensions/docs/static/content_scripts.html
|
| @@ -136,13 +136,14 @@ learn about the
|
| <pre>hello.html
|
| ==========
|
| <html>
|
| - <button id="button">click me</button>
|
| + <button id="mybutton">click me</button>
|
| <script>
|
| - var greeting = "hello!";
|
| - function sayGreeting() {
|
| - alert(greeting);
|
| - }
|
| - document.getElementById("button").onclick = sayGreeting;
|
| + var greeting = "hello, ";
|
| + var button = document.getElementById("mybutton");
|
| + button.person_name = "Bob";
|
| + button.addEventListener("click", function() {
|
| + alert(greeting + button.person_name + ".");
|
| + }, false);
|
| </script>
|
| </html></pre>
|
|
|
| @@ -150,12 +151,13 @@ learn about the
|
|
|
| <pre>contentscript.js
|
| ================
|
| -console.log(greeting); // undefined
|
| -console.log(sayGreeting); // undefined
|
| -console.log(document.getElementById("button").onclick); // still undefined
|
| -document.getElementById("button").onclick = function() {
|
| - alert("hola!");
|
| -}</pre>
|
| +var greeting = "hola, ";
|
| +var button = document.getElementById("mybutton");
|
| +button.person_name = "Roberto";
|
| +button.addEventListener("click", function() {
|
| + alert(greeting + button.person_name + ".");
|
| +}, false);
|
| +</pre>
|
|
|
| <p>Now, if the button is pressed, you will see both greetings.
|
|
|
| @@ -194,7 +196,7 @@ document.getElementById('myCustomEventDiv').addEventListener('myCustomEvent', fu
|
|
|
| <h2 id="security-considerations">Security considerations</h2>
|
|
|
| -When writing a content script, you should be aware of two security issues.
|
| +<p>When writing a content script, you should be aware of two security issues.
|
| 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 (e.g., by <a
|
|
|