开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜