이해가 안되지만 api의 Google 크롬을 인식하지 못하는 것 같습니다.Chrome 확장 프로그램 : '배경 페이지'콘솔에서이 오류가 발생하는 이유는 무엇입니까?
매니페스트 :
{
"name": "First Extension",
"version": "1.0",
"description": "The first extensione tha I made",
"permissions":["contextMenus"],
"background_page": "background_page.html"
}
배경 페이지 :
<!doctype html>
<html>
<head>
<title>Background Page</title>
<script src="script.js"></script>
</head>
<body>
</body>
</html>
자바 스크립트 (script.js가) :
if (window.webkitNotifications) {
console.log("Notifications are supported!");
}
else {
console.log("Notifications are not supported for this Browser/OS version yet.");
}
/////////// BROWSER CONTEXT MENU ////////////////
var arr_context = ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio"];
for(i=0; i<arr_context.length; i++){
var title = arr_context[i];
var menu1 = chrome.contextMenus.create({"type":"normal", "title":"Menu "+title, "contexts":arr_context, "onclick":callBack });
}
function callBack(info, tab){ console.log(info.menuItemId+"; URL: "+tab.url); }
기능 "콜백 (정보 탭)"쓰지 않는다 아무것도. 배경 페이지에 오류가 있습니다. 오류 : Uncaught TypeError: Cannot call method 'create' of undefined
입니다.
모든 파일은 다음과 같습니다.
확장 탭에서 페이지에 액세스하지 못했기 때문에 인터넷에서 실수를 읽었습니다. 그러나 background_page.html을 두 번 클릭하면 .... '많이 무거워요? -.- °
'chrome : // extensions'에서'background_page' 콘솔을 열면'chrome.contextMenues'가 정의되어 있습니다.'chrome.contextMenues.create()'를 수동으로 호출 할 수 있습니까? – abraham
' ** chrome.contextMenues() ** 오류 : 개체 [개체 개체] 가지고있는 방법'contextMenues 없음 ' 크롬 ** ** 개체 ** chrome.contextMenues.create(); ** TypeError : 정의되지 않은 'create'메서드를 호출 할 수 없습니다. ' – Donovant
'chrome.contextMenus'는 'chrome.contextMenus()'가 아닙니다. 업데이트 : 죄송합니다. 'contextMenus'를 잘못 입력 한 첫 번째 주석에 오타가있었습니다. 다시 시도하십시오. – abraham