首页 > 解决方案 > Chrome 扩展 - 如何在选项卡中捕获 Ctrl + V(粘贴)

问题描述

我正在尝试在站点 google 中捕获 Ctrl + V(粘贴),但我的代码不起作用。

chrome.tabs.onActivated.addListener(tab =>{
   chrome.tabs.get(tab.tabId, current_tab_info => {
      if(/^https:\/\/www\.google/.test(current_tab_info.url)){
         $(document).keydown(function(e) {
            if (e.keyCode == 86 && e.ctrlKey) {
                alert('paste');
            }
         });
      }
  });
});

怎么了?

标签: javascript

解决方案


推荐阅读