I'm writing my first Chrome extension which is a couple of links to open URLs. One opens a site through JavaScript and the other is a hard coded link. Neither work. Not sure what I'm doing wrong here.
manifest.json
{
"manifest_version": 2,
"web_accessible_resources": [
"popup.html", "popup.js"
],
"name": "Open URL",
"description": "Opens a URL.",
"version": "1.0.0",
"permissions": ["tabs"],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html",
"default_title": "Open a URL"
}
}
popup.html
<!DOCTYPE html>
<html>
<head>
<title>Open URL</title>
<script src="popup.js"></script>
</head>
<body style="width: 100px;">
<p>Open URL</p>
<p><a href="javascript:OpenURL('http://www.google.com')">Google</a></p>
<p><a href="http://www.stackoverflow.com">Stack Overflow</a></p>
</body>
</html>
popup.js
function OpenURL(location) {
chrome.tabs.create({ url: location });
}