List icon Contents

Profile

This guide describes how to manage Chromium profiles.

Please consider reading the Architecture guide to better understand how JxBrowser architecture is designed, how it works, and what main components it provides.

Overview

Profile stores the user data such as navigation history, cookies, cache, passwords, etc.

The Profile class provides access to the info like profile’s name, the absolute path to the directory where profile stores its data, and provides access to profile-related services such as:

  • ZoomLevels
  • Plugins
  • Proxy
  • Network
  • SpellChecker
  • CookieStore
  • HttpCache
  • HttpAuthCache
  • Downloads
  • Permissions

The Browser instances that belong to the same Profile share the cookies, history, cache, and other data. If you don’t want to share the data between two Browser instances, then you can create multiple profiles and use the Browser instances that belong to the different profiles.

To create and delete profiles, access all the created profiles including the default profile, use the Profiles service:

Java
Kotlin
var profiles = engine.profiles();
val profiles = engine.profiles

Default Profile

When you create an Engine instance, the default profile is created automatically. You can access it using the following approach:

Java
Kotlin
var defaultProfile = profiles.defaultProfile();
val defaultProfile = profiles.defaultProfile()

Incognito

To make the default profile incognito, use the Incognito option when creating an Engine instance. This option affects the default profile only.

Creating Profile

To create a new regular profile, use the Profiles.newProfile(String) method:

Java
Kotlin
var profile = profiles.newProfile("MyProfile");
val profile = profiles.newProfile("MyProfile")

Profile stores its data such as navigation history, proxy settings, cookies, spellchecker configurations, etc. in a separate directory inside the user data directory.

Creating incognito Profile

To create an incognito profile use the following approach:

Java
Kotlin
var profile = profiles.newIncognitoProfile("MyIncognitoProfile");
val profile = profiles.newIncognitoProfile("MyIncognitoProfile")

Getting profiles

You can get a list of all created profiles, including the default profile, using the Profiles.list() method. For example:

Java
Kotlin
var profilesList = profiles.list();
val profilesList = profiles.list()

Deleting Profile

To delete an existing profile use the Profiles.delete(Profile) method. For example:

Java
Kotlin
profiles.delete(profile);
profiles.delete(profile)

When you delete a profile, all browser instances associated with it are closed automatically. An attempt to use an already deleted Profile will lead to the IllegalStateException error.

The default profile cannot be deleted. An attempt to delete the default profile leads to IllegalArgumentException.

Preferences

Each profile has a set of preferences. You can access the profile preferences using the following method:

Java
Kotlin
var profilePrefs = profile.preferences();
val profilePrefs = profile.preferences()

The profile preferences are stored in User Data Directory. They will be restored from the directory when you create an Engine instance.

Web form autofill

You can let JxBrowser fill out forms automatically with saved info, like username and password. When the user enters username and password in a new form online, the library might ask you if you’d like to save it.

Read more in Passwords regarding how to handle the save password requests and manage all saved passwords.

To disable web form autofill use:

Java
Kotlin
profile.preferences().disableAutofill();
profile.preferences().disableAutofill()