Note: Advice in this article will only work for JxBrowser 6. See the corresponding article for JxBrowser 7 here.(注意:本文中的建议仅适用于JxBrowser6,JxBrowser7相应文章请点击这里。)


JxBrowser is based on Google Chromium engine. Some Chromium features uses Google APIs. To access those APIs, an API Key is required. To acquire API Key follow the instruction.(JxBrowser基于Google Chromium引擎。 Chromium的某些功能使用Google API。要访问这些API,需要一个API密钥。要获取API密钥,请按照说明进行操作。)


You can provide the Chromium keys to JxBrowser Chromium engine using one of the following approaches:(您可以使用以下方法之一将Chromium密钥提供给JxBrowser Chromium引擎:)

  1. Via environment variables. Set the GOOGLE_API_KEY, GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET environment variables to your "API key", "Client ID" and "Client secret" values respectively. To find out where to get "API key", "Client ID" and "Client secret" see the video instruction.(通过环境变量。将GOOGLE_API_KEY,GOOGLE_DEFAULT_CLIENT_ID和GOOGLE_DEFAULT_CLIENT_SECRET环境变量分别设置为“ API密钥”,“客户端ID”和“客户端密码”值。要了解从何处获取“ API密钥”,“客户端ID”和“客户端机密”,请参阅视频说明。)
  2. Using the BrowserPreferences.setChromiumVariable(String name, String value) method. For example:(使用BrowserPreferences.setChromiumVariable(String name,String value)方法。例如:)
BrowserPreferences.setChromiumVariable("GOOGLE_API_KEY", "Your API Key");
BrowserPreferences.setChromiumVariable("GOOGLE_DEFAULT_CLIENT_ID", "Your Client ID");
BrowserPreferences.setChromiumVariable("GOOGLE_DEFAULT_CLIENT_SECRET", "Your Client Secret");

Note: You must configure Chromium variables before you create any Browser instance.(注意:在创建任何浏览器实例之前,必须配置Chromium变量。)