[英]Using JavaScript console in Google Chrome how can I get the index of the selected/active/current Tab?
[英]How to get active tab index on Google Chrome extension?
我正在尝试使用 Javascript 为我的 Google Chrome 扩展程序获取活动选项卡的索引。 我应该怎么办?
这有帮助吗? 它还取决于它是从哪里执行的。 此代码段在弹出窗口中的 window 事件上执行。
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.executeScript(
tabs[0].id,
{ code: <your code> });
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.