Detecting the current tab language using Chrome extension?

南楼画角 提交于 2019-12-11 01:23:25

问题


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


回答1:


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);
  });
});



回答2:


Yes: chrome.tabs.detectLanguage. See http://code.google.com/chrome/extensions/tabs.html#method-detectLanguage.



来源:https://stackoverflow.com/questions/7654983/detecting-the-current-tab-language-using-chrome-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!