OLD | NEW |
1 <div id="pageData-title" class="pageData">Message Passing</div> | 1 <div id="pageData-name" class="pageData">Message Passing</div> |
2 <div id="pageData-showTOC" class="pageData">true</div> | 2 <div id="pageData-showTOC" class="pageData">true</div> |
3 | 3 |
4 <p> | 4 <p> |
5 Since content scripts run in the context of a web page and not the extension, | 5 Since content scripts run in the context of a web page and not the extension, |
6 they often need some way of communicating with the rest of the extension. For | 6 they often need some way of communicating with the rest of the extension. For |
7 example, an RSS reader extension might use content scripts to detect the | 7 example, an RSS reader extension might use content scripts to detect the |
8 presence of an RSS feed on a page, then notify the background page in order to | 8 presence of an RSS feed on a page, then notify the background page in order to |
9 display a page action icon for that page. | 9 display a page action icon for that page. |
10 | 10 |
11 <p> | 11 <p> |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 }); | 250 }); |
251 | 251 |
252 background.html | 252 background.html |
253 =============== | 253 =============== |
254 chrome.tabs.sendRequest(tab.id, {greeting: "hello"}, function(response) { | 254 chrome.tabs.sendRequest(tab.id, {greeting: "hello"}, function(response) { |
255 // innerText does not let the attacker inject HTML elements. | 255 // innerText does not let the attacker inject HTML elements. |
256 document.getElementById("resp").innerText = response.farewell; | 256 document.getElementById("resp").innerText = response.farewell; |
257 }); | 257 }); |
258 </pre> | 258 </pre> |
259 | 259 |
OLD | NEW |