this is my manifest.json file
{
"name": "My First Extension",
"version": "1.0",
"description": "The first extension that I made.",
"background_page": "background.html",
"page_action":
{
"default_icon": "icon.png"
},
"permissions" : [
"tabs"
]
}
This is the background.html
<html>
<head>
<script>
// Called when the url of a tab changes.
function checkForValidUrl(tabId, changeInfo, tab) {
// If the letter 'page' is found in the tab's URL...
if (tab.url.indexOf('google') > -1) {
// ... show the page action.
chrome.pageAction.show(tabId);
}
};
// Listen for any changes to the URL of any tab.
chrome.tabs.onUpdated.addListener(checkForValidUrl);
chrome.pageAction.onClicked.addListener(function(tab)
{
tab.url = 'www.bing.com';
console.log('I am clicked');
}
);
</script>
</head>
</html>
when i click on the page action icon , i want to redirect the page to Bing.com, but this click event is not working for me.
Thanks