tabs.detectLanguage()

Detects the primary language of the content in a tab.

Syntax

browser.tabs.detectLanguage(
  tabId,                   // optional integer
  function(language) {...} // function
)

Parameters

tabIdOptional
integer. Defaults to the active tab of the current window.
callback
function. The function is passed the following arguments:
language
string. An ISO language code such as en or fr. For a complete list of languages supported by this method, see kLanguageInfoTable. The 2nd to 4th columns will be checked and the first non-NULL value will be returned except for Simplified Chinese for which zh-CN will be returned. For an unknown language, und will be returned.

Browser compatibility

EdgeFirefoxChromeOpera
Basic support?45.0Yes33
Firefox
Basic supportNo

Examples

Acknowledgements

This API is based on Chromium's chrome.tabs API. This documentation is derived from tabs.json in the Chromium code.

Document Tags and Contributors

 Contributors to this page: wbamberg
 Last updated by: wbamberg,