使用Chrome扩展程序检测当前选项卡语言? [英] Detecting the current tab language using Chrome extension?

查看:96
本文介绍了使用Chrome扩展程序检测当前选项卡语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用chrome API来检测当前标签中当前内容的语言? 使用chrome API检测当前内容的语言 Chrome Tabs API 选择当前标签,然后获取

示例用法: tab
chrome.tabs.getSelected(null,function(tab){
chrome.tabs.detectLanguage(tab.id,function(language){
console.log(language);
});
});


Is there a way to use chrome API to detect the language of the current content in the current tab?

解决方案

Use the Chrome Tabs API to select the current tab, then get the language.

Sample usage:

//Get language of current tab
chrome.tabs.getSelected(null, function(tab) {
  chrome.tabs.detectLanguage(tab.id, function(language) {
    console.log(language);
  });
});

这篇关于使用Chrome扩展程序检测当前选项卡语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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