在Google Chrome浏览器中使用JavaScript控制台,如何获取所选/活动/当前标签页的索引? [英] Using JavaScript console in Google Chrome how can I get the index of the selected/active/current Tab?

查看:131
本文介绍了在Google Chrome浏览器中使用JavaScript控制台,如何获取所选/活动/当前标签页的索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试检索当前活动/选定/当前选项卡的索引.运行什么命令将检索索引?

I am trying to retrieve the index of the currently active/selected/current tab. What is the command to run which will retrieve the Index?

推荐答案

您需要使用

You would need to use Chrome API for this, which is available to extensions and apps.

chrome.tabs.getSelected(null, function(tab){
    console.log("index:", tab.index);
});

这篇关于在Google Chrome浏览器中使用JavaScript控制台,如何获取所选/活动/当前标签页的索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆