Chrome新选项卡事件 [英] Chrome new tab event
本文介绍了Chrome新选项卡事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Chrome中创建新标签时触发事件。我认为下面会做,但似乎没有。 (新手)
manifest.json
<$ c $
name:My First Extension,
version:1.0,
description:我做的第一个扩展。,
background_page:background.html,
permissions:[
标签
]
}
pre>
background.html
< html>
< head>
< script type =text / javascript>
chrome.tabs.onCreated.addListener(function(){alert('hello new tab'));
< / script>
< / head>
< body>
< / body>
< / html>
解决方案你是否错过了一个关闭
)
括号?... {alert('hello new tab'});
^
因为除此之外,您的代码适合我。
I want to fire an event when a new tab is created in Chrome. I thought the following would do it, but it seems not. (beginner)
manifest.json
{ "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "background_page": "background.html", "permissions": [ "tabs" ] }
background.html
<html> <head> <script type="text/javascript"> chrome.tabs.onCreated.addListener(function() {alert('hello new tab'}); </script> </head> <body> </body> </html>
解决方案Are you just missing a closing
)
bracket?...{alert('hello new tab'}); ^
Because other than that your code works for me.
这篇关于Chrome新选项卡事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文