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' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -