Skip to main content

Craig Kerstiens

Converting Bookmarklet to Chrome Extension

Google’s documentation is pretty good when it comes to how to create an extension that opens a full page and has large functionality. But if you’re more interested in transforming an existing bookmarklet into an extension there’s not great quality on it. The steps themselves are really quite simple. The big key that’s not heavily documented is creating a background html that creates an event listener. After the jump is a full sample that would then call your javascript to activate the bookmarklet:

manifest.json

background.html

chrome.browserAction.onClicked.addListener(function(tab) { chrome.tabs.sendRequest(tab.id, {fun: “callBM”}) }); </script> bm.js