4 The
<code>event_rules
</code> manifest property provides a mechanism to add rules that intercept, block, or modify web requests in-flight using
<a href=
"../declarativeWebRequest">declarativeWebRequest
</a> or take actions depending on the content of a page, without requiring permission to read the page's content using
<a href=
"../declarativeContent">declarativeContent
</a>.
7 <h2 id=
"translation">Translating rules from javascript to manifest
</h2>
10 The following defines a rule to display a page action if the current page has a video css tag in javascript:
13 <pre data-filename=
"example.js">
14 chrome.
<b>declarativeContent.onPageChanged
</b>.addRules([{
16 new chrome.
<b>declarativeContent.ShowPageAction
</b>()
19 new chrome.
<b>declarativeContent.PageStateMatcher
</b>(
20 <b>{css: [
"video"]}
</b>
27 This is the same definition in the manifest:
30 <pre data-filename=
"manifest.json">
32 "name":
"Sample {{platform}}",
34 "event":
<b>"declarativeContent.onPageChanged"</b>,
36 "type":
<b>"declarativeContent.ShowPageAction"</b>
39 "type":
<b>"declarativeContent.PageStateMatcher"</b>,
40 <b>"css": [
"video"]
</b>