javascript - Troubleshoot Chrome Search Extension -


i've been trying make basic chrome extension search wayback machine based off link. i'm trying set when right-click link, context menu has 'go wayback machine' option. have:

manifest.json:

{   "name" : "archive right click",   "manifest_version" : 2,   "version" : "1.0",   "description" : "adds go archive right-click context menu.",   "icons" : {     "16" : "icon-16.png",     "48" : "icon-48.png"   },   "browser_action" : {     "default_icon": "icon-16.png",     "default_title" : "go archive"   },   "permissions" : [     "tabs",     "contextmenus"   ],   "background" : {     "scripts" : ["script.js"]   } } 

script.js:

function searcharchive(info,tab) {     var url = info.linkurl;     var archiveurl = "https://web.archive.org/web/*/" + url;     chrome.tabs.create({         url : archiveurl,     }); }  chrome.contextmenus.create(     {         "context" : ["link"],         "title" : "open link in archive",         "onclick" : searcharchive     }); 

the problem doesn't show in context menu let alone open tab want.

let me know useful tutorials on chrome extensions. haven't been able find beginner resource provides examples.

you should change context contexts in script.js

function searcharchive(info,tab) {     var url = info.linkurl;     var archiveurl = "https://web.archive.org/web/*/" + url;     chrome.tabs.create({         url : archiveurl,     }); }  chrome.contextmenus.create({     "contexts" : ["link"]     "title" : "open link in archive",     "onclick" : searcharchive }); 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -