Reputation: 21
I'm starting to learn about chrome extension, I had already created one, but when I try to open a new tab it open inside the extensions directory and not in a complete and clean new tab. It opens chrome-extension://ifaaiadijbjgfapbljbcifcjekajllnl/www.google.com instead of just www.google.com
{
"manifest_version": 2,
"name": "Open tab",
"description": "Click to open google.com"
"version": "1.0",
"background" : {
"scripts" : ["google.js"]
},
"browser_action": {
"default_icon": "icon-16.png",
"default_title": "Click to open google.com"
},
"permissions": [
"activeTab",
"tabs"
],
"icons":{ "16": "icon-16.png", "128": "icon-128.png" }
}
chrome.browserAction.onClicked.addListener(function() {
chrome.tabs.query({'active': true, 'lastFocusedWindow': true}, function (tabs)
{
link = "www.google.com"
chrome.tabs.create({url:link})
});
})
Upvotes: 2
Views: 238
Reputation: 286
Define Your var link as:
link = 'https://www.google.com'
Hope that will solve your problem. Good luck.
Upvotes: 1