Profiles
This guide describes how to work with the application profiles.
Overview
Application profile stores the user data such as history, cookies, cache, proxy settings, spellchecker configurations, saved 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 the profile-level functionality such as:
- Proxy
- Network
- Cookies
- Cache
- Downloads
- Permissions
- Spellchecking
- User data profiles
- Passwords
- Credit cards
The Browser
instances within the same Profile
share cookies, history, cache, and other data.
Tip: 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
App::profiles()
service:
auto profiles = app->profiles();
Default profile
When you initialize an App
, the default profile is created automatically. You can access by using this method:
auto defaultProfile = app->profile();
Incognito
To make the default profile incognito, use the
AppOptions::enable_incognito
when initializing the application.
This option affects the default profile only.
AppOptions options;
options.enable_incognito = true;
App::init(options, [](std::shared_ptr<App> app) {
// ...
});
Creating profiles
To create a new regular profile, use the Profile::create()
method:
auto profile = Profile::create(app, "Person A");
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 profiles
To create an incognito profile, call Profile::createIncognito(...)
method:
auto profile = Profile::create(app, "Incognito");
Deleting profiles
To delete an existing profile use the App::deleteProfile()
method:
app->deleteProfile(profile);
When you delete a profile, all browser instances associated with it are closed automatically.
The default profile cannot be deleted.
Preferences
Each profile has a set of preferences. You can access the profile preferences using the
Profile::prefs()
method:
auto prefs = profile->prefs();
The profile preferences are stored in the
user data directory. They will be restored from the
directory when you initialize an App
.
Web form autofill
You can let Molybden fill out forms automatically with saved info, like username and password. When the user enters username and password in a new form online, the browser might ask you if you’d like to save it.
Read more in Passwords on how to handle the save password requests and manage the saved passwords.
To disable web form autofill use:
profile->prefs()->disableAutofill();