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:

Profiles 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:

Profile 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:

Profile 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:

Profile 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:

List<Profile> profiles = profiles.list();

Deleting Profile

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

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.

Go Top