Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6527)

Unified Diff: chrome/common/extensions/docs/extensions/options.html

Issue 10824073: Updating `options_page` documentation to work under CSP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Status. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/extensions/docs/static/options.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/extensions/options.html
diff --git a/chrome/common/extensions/docs/extensions/options.html b/chrome/common/extensions/docs/extensions/options.html
index fad14202b636b0a86353006a055a32a7444cbf16..71680e4d9e470a394e801a23feb80a851a13ed4d 100644
--- a/chrome/common/extensions/docs/extensions/options.html
+++ b/chrome/common/extensions/docs/extensions/options.html
@@ -222,9 +222,7 @@
}</pre>
<a name="H2-1"></a><h2>Step 2: Write your options page</h2>
Here is an example options page:
-<pre>&lt;html&gt;
-&lt;head&gt;&lt;title&gt;My Test Extension Options&lt;/title&gt;&lt;/head&gt;
-&lt;script type="text/javascript"&gt;
+<pre>// Save this script as `options.js`
// Saves options to localStorage.
function save_options() {
var select = document.getElementById("color");
@@ -252,8 +250,13 @@ function restore_options() {
}
}
}
-&lt;/script&gt;
-&lt;body onload="restore_options()"&gt;
+document.addEventListener('DOMContentReady', restore_options);
+document.querySelector('#save').addEventListener('click', save_options);
+</pre>
+<pre>&lt;html&gt;
+&lt;head&gt;&lt;title&gt;My Test Extension Options&lt;/title&gt;&lt;/head&gt;
+&lt;script src="options.js"&gt;
+&lt;body&gt;
Favorite Color:
&lt;select id="color"&gt;
&lt;option value="red"&gt;red&lt;/option&gt;
@@ -262,7 +265,8 @@ Favorite Color:
&lt;option value="yellow"&gt;yellow&lt;/option&gt;
&lt;/select&gt;
&lt;br&gt;
-&lt;button onclick="save_options()"&gt;Save&lt;/button&gt;
+&lt;div id="status"&gt;&lt;/div&gt;
+&lt;button id="save"&gt;Save&lt;/button&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
« no previous file with comments | « no previous file | chrome/common/extensions/docs/static/options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698