2
Chromeの通知を作成するGoogle Chromeのブラウザ拡張コンテキストメニューのドロップダウンメニューをユーザーがクリックしたときに表示されるようにしようとしています。私が間違っていることについての洞察は非常に高く評価されます。Chromeを「Rich Notification」APIをドロップダウンメニューに接続する
サイドノート:これはすべて、クリックするとポップアップボックスを開くChrome Navbarのデフォルトのポップアップに接続されています。
chrome.runtime.onInstalled.addListener(function() {
var context = "selection";
var title = "Add To test";
var id = chrome.contextMenus.create({"title": title, "contexts":[context],
"id": "context" + context});
});
var options = {
type: "basic",
title: "Primary Title",
message: "Primary message to display",
iconURL: "test_logo.png"
};
chrome.contextMenus.onClicked.addListener(function() {
chrome.notifications.create(options, blarg);
});
function blarg() {
console.log("Pop UP FOR LIFE");
}
お返事ありがとうございますが、私はまだこのエラーが発生しています: "contextMenusのイベントハンドラでエラーが発生しました:TypeError:プロパティ '未定義の'を作成できません。 – Shawn
適切な権限がありません。マニフェストパーミッションには '' contextMenus''と '' notifications''が必要です。 – Xan
ありがとうございました! – Shawn