I’m trying to make a Chrome extension that gets the current page’s URL and uses it to create and show a QR code that links to it with the below Google API.
This is my popup.js
chrome.tabs.getSelected(null,function(tab) {
var tablink = tab.url;
});
document.write('https://chart.googleapis.com/chart?chs=100x100&cht=qr&chl=' + tablink);
and this is my manifest.json
{
"name": "Qrit",
"version": "1.0",
"manifest_version": 2,
"description": "Instantly creates a QR Code that links to the current page.",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": [
"tabs"
]
}
The problem is that the popup is simply blank.
I know almost nothing about Javascript, nor Json.
As Tom said, with manifest version 2 you cant have inline scripts. Also,
chrome.tabs.getSelectedis decapitated and you should usechrome.tabs.query.Here’s something to get you started….
manifest.json
popup.html
popup.js