diff --git a/_layouts/default.html b/_layouts/default.html new file mode 100644 index 0000000..55cf05b --- /dev/null +++ b/_layouts/default.html @@ -0,0 +1,16 @@ + + + + + + + + + +content script DOM access
+ +content script <-> page script messaging
+ + + + diff --git a/content-script-dom-access.html b/content-script-dom-access.html new file mode 100644 index 0000000..c93a215 --- /dev/null +++ b/content-script-dom-access.html @@ -0,0 +1,60 @@ + +

This is a web page for testing content scripts

+ +

This is a web page for testing the kind of access content scripts get to the web pages they run inside. +The page includes a page script, which does three things: +

+ + + +

If you now install the content-scripts extension, and reload the page, you'll now see two columns of buttons underneath this text.

+ +

Each column contains three buttons:

+ + +

The exact same code is running in each column. But the left-hand column is running in the page script, while the right-hand button is running in the content script. So you'll see the following:

+ + + +
+
+
+
+
+
+ + +
+ + + diff --git a/content-script-page-script-messaging.html b/content-script-page-script-messaging.html new file mode 100644 index 0000000..968e12d --- /dev/null +++ b/content-script-page-script-messaging.html @@ -0,0 +1,16 @@ + + + + + + + +

This page demonstrates messaging between page scripts and content scripts.

+

To try it out, first install the WebExtension from https://github.com/mdn/webextensions-examples/tree/master/page-to-extension-messaging, then reload this page.

+

Clicking one button sends a message from the page script to the content script: the content script just displays an alert when it receives the message. Clicking the other button sends a message the other way.

+ + + + + + diff --git a/index.md b/index.md new file mode 100644 index 0000000..0d6905d --- /dev/null +++ b/index.md @@ -0,0 +1,3 @@ +--- +layout: default +---