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.