[過去ログ] JavaScript の質問用スレッド vol.125 (1002レス)
1-

このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
767
(1): (ワッチョイ a3ad-a1qf [210.250.191.46]) 2023/03/20(月)19:47 ID:PTBUy+ct0(1/4) AAS
chromeの拡張機能で、「ngWord.json」内のデータを「background.js」経由で「content_script.js」に格納しようとしていたのですが、上手くいきません。コードでおかしな点等あれば、ご教授頂けないでしょうか。

【background.js】
fetch('ngWord.json')
.then(response => response.json())
.then(data => {
// content_script.jsにデータを送信
chrome.runtime.sendMessage({ngWords: data});
});

【content_script.js】
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.ngWords) {
const ngWords = message.ngWords;
console.log(ngWords); // 受信したデータを表示
}
});
1-
あと 235 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.008s