Important: Please read the Qt Code of Conduct -

How to enable LocalStorage in Qt 5.3

  • I tried the method:

    QWebSettings* settings = QWebSettings::globalSettings();
    settings->setAttribute(QWebSettings::LocalStorageEnabled, true);
    auto path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);


    window.localStorage is not undefined, but when I insert a item into the localStorage:


    The error is happened, and the error messages in the webkit inspector console are:

    bq. QuotaExceededError: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota.

  • I forgot I've enable a very important swithcer:

    This will set the browser to private mode and prevent you to insert value to localStorage. But the official api doc doesn't mention it.

    You just set disable the switcher can solve the problem:


Log in to reply