javascript - 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');
}
});
}
});
});
怎么了?
解决方案
推荐阅读
- php - php.ini 中的更改未反映 PHP Memory_Limit Master Value
- python - 如何在python中使用文本文件求解具有多个参数数据的微分方程?
- php - Zend Framework 3 中的 CSRF 问题与 Ajax 表单
- selenium - 如果 selenium webdriver 中的条件问题
- git - 将 gitlab 存储库转移到另一个驱动器
- php - 如何从会话变量中获取多个复选框值
- javascript - 如何将值从 Javascript 传递到代码函数背后的代码?
- sql-server - 使用 SQL 中的模式匹配预测供应商/贸易商列表中的类似供应商
- c - 为什么我的代码没有给出正确的输出?
- wordpress - Wordpress 5+ 自动将所有图库图像链接到媒体文件