DeclarativeContent in Manifest V3 – how to disable action on non-matching pages?

9 views
Skip to first unread message

Enosh Joseph

unread,
12:18 AM (2 hours ago) 12:18 AM
to chromium-...@chromium.org, olive...@google.com
Hi,

I’m developing a Chrome extension using Manifest V3 and trying to achieve page-action–like behavior (enable the extension only on specific pages).

I’m using chrome.declarativeContent with PageStateMatcher and ShowAction() to enable the action on matching URLs (for example, Wikipedia article pages).

However, I noticed that:

  • chrome.declarativeContent.HideAction() does not exist in MV3

  • ShowAction() only enables the action, but there is no declarative way to disable or hide it on non-matching pages

  • Once the action is enabled (or pinned), it stays enabled on all pages

This leads to a few questions:
  • Is it expected behavior in MV3 that declarativeContent can only enable actions but not disable them?

I want to make sure I’m following the official and future-proof pattern.

image.png

image.png
here is my eventPage.js and manifest.json

Thanks in advance!

Reply all
Reply to author
Forward
0 new messages