ICYMI: Chrome Extension Dev in 2025: Surviving MV3 http://dlvr.it/TTGCR4

seen from Spain
seen from Russia
seen from Canada
seen from Belgium

seen from United States
seen from United States

seen from Malaysia

seen from Netherlands
seen from United States
seen from United Kingdom
seen from United States
seen from United Kingdom
seen from United States
seen from United States

seen from United States
seen from Uruguay

seen from United States
seen from Yemen
seen from Brazil

seen from Malaysia
ICYMI: Chrome Extension Dev in 2025: Surviving MV3 http://dlvr.it/TTGCR4
Chrome Extension Dev in 2025: Surviving MV3 http://dlvr.it/TTFcpZ
Hardening Chrome Enterprise 2026
Read the full report on -
CyberDudeBivash News delivers daily cybersecurity threat intel, CVE alerts, malware trends, and crypto security briefings.
CYBERDUDEBIVASH Zero-Trust Extension Management
Read the full report on -
CyberDudeBivash News delivers daily cybersecurity threat intel, CVE alerts, malware trends, and crypto security briefings.
💡 How to Build a Chrome Web Scraping Extension — A Complete Developer Guide 🛠️🕸️
Want to automate data collection directly in the browser? Our step-by-step developer guide walks you through building a production-ready Chrome extension for #WebScraping - from architecture and manifest setup to scraping patterns, request handling, storage, and ethical/compliance best practices.
What you’ll learn:
Project scaffolding & Chrome manifest v3 basics
Designing background/service workers, content scripts & messaging
DOM scraping patterns, selectors, and robust extraction strategies
Handling pagination, lazy-loading, CAPTCHAs & rate limits safely
Using browser APIs for storage, downloads, and network interception
Building a lightweight UI (popup/options) and telemetry hooks
Error handling, retries, and observability for reliability
Packaging, publishing, and lifecycle maintenance (updates & permissions)
Legal, ethical & terms-of-service considerations - scraping responsibly
👉 Read the full guide: https://www.actowizsolutions.com/build-chrome-web-scraping-guide-extension.php
📩 For custom implementations or enterprise scraping solutions: [email protected]
#Libredirectとは何か?YouTube、Xなどをプライバシーに配慮したフロントエンドにリダイレクトするためのWeb拡張機能 🛡️🌐✨🔒 #プライバシー #ウェブ拡張機能 #脱プラットフォーム 補足資料 補足1:このレポートを読んだ感想 ずんだもんの感想なのだ: えー、Libredirect、なんだか難しそうな話だったのだ。でも、YouTubeとかXでずんだもんのことを見るときに、あんまり個人情報取られたくないから、これ Tags: 1, 2025-06-22t09:41:45z, libredirect, manifestv3, sns, ウェブ拡張機能, トラッキング, プライバシー, 代替フロントエンド via Pocket https://dopingconsomme.blogspot.com/2025/06/libredirect.html June 22, 2025 at 06:47PM
contextMenuを使ったChrome拡張機能のManifest V3対応
目標
Manifest V3環境のChrome拡張機能でcontextMenuに独自メニューを追加
状況に応じて文字列と表示(Visible)を切り替える
環境
Google Chrome: 99.0.4844.51 (64bit)
拡張機能の概要
ブログランキング/更新情報サイトから指定したブログを消す(非表示にする)拡張機能
ブログ要素(ブログそのものか記事へのリンク)のcontextMenuに独自メニュー「$(blog_name)をミュート」を追加
クリックすると当該ブログは非表示リストに登録され、二度と表示されなくなる
ソース
V2版:https://github.com/lvnkae/blog-collection-filter/tree/firefox
V3版:https://github.com/lvnkae/blog-collection-filter/tree/master
Manifest V2での実装
background.persistentはtrue(永続する)
[content_scripts]contextMenu状態変更要求messageをbackgroundへ送信
右クリック押下時(mousedownイベント)
カーソル下にある要素を調べ
ブログ要素(ブログそのものか記事へのリンク)だったら、contextMenuの独自メニューを「$(blog_name)をミュートする」に切り替え、visibleをonにするmessage
messageにはブログURL/ブログ名も乗せる
ブログ要素でなければvisibleをoffにするmessage
[background]独自メニューがクリックされたら通知messageをcontent_scriptsへ送信
contextMenus.createの"onclick"に登録したfunctionが起点
状態変更要求で受け取ったブログURL/ブログ名を保持しておき、通知に乗せる
[content_scripts]通知を受け取ったら非表示リスト(storage)へ登録
Manifest V3での変更点
background.service_workerに移行
background.scriptsおよびbackground.persistentが廃止された
background用jsの記述方法変更
background_root.jsを設けbackground用jsをimport、manifest.jsontと同じディレクトリに配置
background.service_workerには1ファイルしか指定できない
指定ファイルはmanifest.jsonと同じ位置に置く必要がある
contextMenus.createのタイミング変更
runtime.onInstalled.addListener、runtime.onStartup.addListenerの2箇所
service_workerは定期的に無効化される
有効化されるたびにスクリプトが読み直されるので、初期化タイミングでcreateすると多重生成になる
errorが出るだけで害はないが気持ち悪い
onInstalledは拡張機能インストール時、onStartupはchrome開始とバージョンアップで発火(らしい)
contextMenuのclicked-callback登録方法変更
contextMenus.onClicked.addListenerで登録
service_workerではcontextMenus.createの"onclick"使用不可
listenerはservice_worker無効化で捨てられるので、background初期化(スクリプト読み込み)時に毎回登録
background側でのパラメータ保持をstorageへ移行
content_scriptsから受信したパラメータをglobal-workにcopy、storage.local.setで保存
具体的にはブログURLとブログ名
background初期化(スクリプト読み込み)時にstorage.local.getでglobal-workへ取り出し
スクリプト内での参照はglobal-work
storageのget/setは非同期処理なのでできるだけ触りたくない
get完了前にset叩いたらどうなるの?とか
扱うパラメータが100byte程度なのにgetに15msecかかることもある
できればsetもservice_worker無効化時だけにしたいが、それをhookするイベントはなさそう
V2ではcontextMenuを管理するBGContextMenuController-classをinstance化しパラメータを持たせていた
service_workerは定期的に無効化されinstanceごと捨てられてしまうので❌
contextMenus.createに渡すidを固定文字列に変更
V2ではextentionIDを使用
background側では取得できずcontent_scriptsから来るmessageに付加されるものを利用
createのタイミング変更でmessageを待てなくなった
固定文字列でも意図的にかぶせてこられない限りはバッティングしないはず
独自メニューの切り替えタイミング変更
右クリック押下(mousedownイベント)→マウスカーソル移動(mosemoveイベント)
mousedownでは間に合わないケースが出てきた
具体的には、service_worker再有効化直後の右クリック
最初の1回だけ(最有効化からの経過時間に関係なく)mousedownでの状態変更messageが間に合わない
理由は不明
裏表通信とはいえ、カーソル移動のたびにmessageを出すのは罪が重そうなので、状態が変わった場合だけ送信
変化監視用にcontent_scriptsに状態を持たせたため、不具合具合の温床になった(案の定)
複数tabをまたいだ場合に状態が残ってしまったり
あちこち継ぎ接ぎを当てるハメになった、複雑化よくない
Manifest V3の留意点
service_workerは30秒で無効化される
performance.now()で複数回計測
"最後にスクリプトが動いてから"ではなく起動(onStartup)から30秒
何らか処理してたらさすがに待ってくれる?例えば大容量のstorage.local.set中(確認してない)
service_workerのデバッガ(DevTools)を開いていると無効化されないので注意が必要
service_worker無効化状態でbackgroundで何らか処理する必要が生じたら最有効化
本記事の拡張機能ではcontent_scriptsからのmessage受信とcontextMenu独自メニューclick
どちらもlistenerでhookされており、listenerは初期化(スクリプト読み込み)時にaddしているにも関わらず、初期化前に最有効化がstartするのは不思議
例えばcontextMenus.onClicked.addListenerをonInstalledでのみ叩くよう変更すると、service_worker再有効化後にcontextMenuのcliked-callbackが呼ばれない(=毎回捨てられている)
無効化の挙動がchrome98と99で違う?
[22/03/15 99.0.4844.51]content_scriptsが無い(=matchsに記載されたサイトを開いていない)と30秒で無効化、在ると5分強で無効化
[22/02/28 恐らく98.0.4758.102]何をしていても30秒で無効化されていた
この間変わったことといえばchromeのversionくらい
ダウングレードして確認…はさすがに面倒くさい
popupからbackgroundへ直接messageを送信できない
詳細(stackoverflow)
改めて確認したら普通に送信できている。chrome99で修正された?