问题
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