event_rules
Stay organized with collections
Save and categorize content based on your preferences.
Warning: The Chrome Web Store no longer accepts Manifest V2 extensions. Follow the Manifest V3 Migration guide to convert your extension to Manifest V3.
Note: You have been redirected from Manifest V3. Chrome extensions no longer support this feature.
The event_rules
manifest property provides a mechanism to add rules that intercept, block, or
modify web requests in-flight using declarativeWebRequest or take actions depending on the
content of a page, without requiring permission to read the page's content using
declarativeContent .
Translating rules from javascript to manifest
The following defines a rule to display a page action if the current page has a video css tag in
javascript:
chrome . declarativeContent . onPageChanged . addRules ([{
actions : [
new chrome . declarativeContent . ShowPageAction ()
],
conditions : [
new chrome . declarativeContent . PageStateMatcher (
{ css : [ "video "]}
)
]
}]);
This is the same definition in the manifest:
{
"na me ": "Sample ex tens io n ",
"eve nt _rules ": [{
"eve nt ": "declara t iveCo ntent .o n PageCha n ged ",
"ac t io ns ": [{
"t ype ": "declara t iveCo ntent .ShowPageAc t io n "
}],
"co n di t io ns ": [{
"t ype ": "declara t iveCo ntent .PageS tate Ma t cher ",
"css ": [ "video "]
}]
}],
...
}
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2015-06-12 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2015-06-12 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2015-06-12 UTC."]]