Regarding google chrome extension development (tabs.onUpdated.addListener())
I am developing a google chrome extension.I want the extension to record whenever a webiste is loaded or the URL in the tab changed. I have written the following javas开发者_C百科cript code to show a dialog box whenever a tab is updated but for some reason It gives Uncaught Syntaxerror:Unexpected Identifier.
Here is the code
<html>
<head>
<script>
chrome.tabs.onUpdated.addListener(function(integer tabId, object changeInfo, Tab tab)
{
//if(tab.url!="")
alert(tab.url);
});
</script>
</head>
<body>
</body>
</html>
Please help.I am really not able to find a solution.
Javascript is not strictly typed, so try remove the integer
, object
and Tab
:
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab)
{
//if(tab.url!="")
alert(tab.url);
});
That should do the trick.
精彩评论