I am new to chrome extension. I have tried the first sample exercise for creating extension. Now I am trying to open an URL in a new tab from the extension popup. Just I have added a HTML anchor tag in the popup.html page.
a href="www.google.com">Click</a>
But its not opening. It is trying to open the URL with following url within the popup itself.
chrome-extension://ljamgfaclheagbikmcagffcbdbcoodna/www.google.com
My popup.html has this code.
<!doctype html>
<html>
<head>
<title>Getting Started Extension's Popup</title>
<style>
</style>
<!-- JavaScript and HTML must be in separate files for security. -->
</head>
<body>
<b>Karthick</b>
<a href="www.google.com">Click</a>
</body>
</html>
And My Manifest.json have the following JSON
{
"name": "Test Extension",
"version": "1.0",
"manifest_version": 2,
"description": "The first extension for my test",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": [
"tabs"
]
}
I dont have written anything in popup.js I searched for it how to do it. But they said that I have to use the following.
chrome.tabs.getSelected({}, function(tab) {
chrome.tabs.update(tab.id, {url: 'http://google.com'});
});
But I don't know the proper way/where to do it. Please tell me the steps to do it. Thanks in advance.