页面对插件通信方法
页面的 JS
- $(function(){
- Chrome.runtime.onMessage.addListener(
- function (request, sender, sendResponse) {
- console.log(request);
- }
- );
- })
插件的 JS
- Chrome.runtime.sendMessage({"name":"啦啦"},function(){
- alert('发送成功');
- })
来源: http://www.bubuko.com/infodetail-3303370.html