Reputation: 29
Ok, I am getting two errors with my Extension for chrome, The first error is
Uncaught TypeError: Cannot read property 'addListener' of undefined
with the second error being:
Unchecked runtime.lastError
They both occur in the same javascript file, which is as follows:
var contextMenuItem = {
"id": "RemoveItReportItRecordIt",
"title": "Remove It",
"contexts" : ["all"]
};
chrome.contextMenus.create(contextMenuItem);
chrome.contextMenus.OnClick.addListener(function(clickData) {
if(clickData.menuItemId == "RemoveItReportItRecordIt")
{
if(clickData.SelectionText) return;
else
alert("ClickData = " + clickData);
}
});
Can you tell me and show me what I a doing wrong?
Upvotes: 0
Views: 183
Reputation: 2786
The correct name of the event is onClicked
, not OnClick
. Using past tense in the event names seems to be fairly common in Chrome's extension API.
Upvotes: 2