Skip to content

Latest commit

 

History

History
548 lines (311 loc) · 10.7 KB

browsingData.rst

File metadata and controls

548 lines (311 loc) · 10.7 KB

≡ browsingData API

browsingData API

Use the chrome.browsingData API to remove browsing data from a user's local profile.

.. rst-class:: api-main-section

Permissions

.. api-member::
   :name: :permission:`browsingData`

   Clear recent browsing history, cookies, and related data

.. rst-class:: api-permission-info

Note

The permission browsingData is required to use messenger.browsingData.*.

.. rst-class:: api-main-section

Functions

remove(options, dataToRemove)

.. api-section-annotation-hack::

Clears various types of browsing data stored in a user's profile.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``options``
      :type: (:ref:`browsingData.RemovalOptions`)


   .. api-member::
      :name: ``dataToRemove``
      :type: (:ref:`browsingData.DataTypeSet`)

      The set of data types to remove.


.. api-header::
   :label: Required permissions

   - :permission:`browsingData`

removeAppcache(options)

.. api-section-annotation-hack::

Clears websites' appcache data.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``options``
      :type: (:ref:`browsingData.RemovalOptions`)


.. api-header::
   :label: Required permissions

   - :permission:`browsingData`

removeCache(options)

.. api-section-annotation-hack::

Clears the browser's cache.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``options``
      :type: (:ref:`browsingData.RemovalOptions`)


.. api-header::
   :label: Required permissions

   - :permission:`browsingData`

removeCookies(options)

.. api-section-annotation-hack::

Clears the browser's cookies and server-bound certificates modified within a particular timeframe.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``options``
      :type: (:ref:`browsingData.RemovalOptions`)


.. api-header::
   :label: Required permissions

   - :permission:`browsingData`

removeDownloads(options)

.. api-section-annotation-hack::

Clears the browser's list of downloaded files (not the downloaded files themselves).

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``options``
      :type: (:ref:`browsingData.RemovalOptions`)


.. api-header::
   :label: Required permissions

   - :permission:`browsingData`

removeFileSystems(options)

.. api-section-annotation-hack::

Clears websites' file system data.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``options``
      :type: (:ref:`browsingData.RemovalOptions`)


.. api-header::
   :label: Required permissions

   - :permission:`browsingData`

removeFormData(options)

.. api-section-annotation-hack::

Clears the browser's stored form data (autofill).

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``options``
      :type: (:ref:`browsingData.RemovalOptions`)


.. api-header::
   :label: Required permissions

   - :permission:`browsingData`

removeHistory(options)

.. api-section-annotation-hack::

Clears the browser's history.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``options``
      :type: (:ref:`browsingData.RemovalOptions`)


.. api-header::
   :label: Required permissions

   - :permission:`browsingData`

removeIndexedDB(options)

.. api-section-annotation-hack::

Clears websites' IndexedDB data.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``options``
      :type: (:ref:`browsingData.RemovalOptions`)


.. api-header::
   :label: Required permissions

   - :permission:`browsingData`

removeLocalStorage(options)

.. api-section-annotation-hack::

Clears websites' local storage data.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``options``
      :type: (:ref:`browsingData.RemovalOptions`)


.. api-header::
   :label: Required permissions

   - :permission:`browsingData`

removePasswords(options)

.. api-section-annotation-hack::

Clears the browser's stored passwords.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``options``
      :type: (:ref:`browsingData.RemovalOptions`)


.. api-header::
   :label: Required permissions

   - :permission:`browsingData`

removePluginData(options)

.. api-section-annotation-hack::

Clears plugins' data.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``options``
      :type: (:ref:`browsingData.RemovalOptions`)


.. api-header::
   :label: Required permissions

   - :permission:`browsingData`

removeWebSQL(options)

.. api-section-annotation-hack::

Clears websites' WebSQL data.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``options``
      :type: (:ref:`browsingData.RemovalOptions`)


.. api-header::
   :label: Required permissions

   - :permission:`browsingData`

settings()

.. api-section-annotation-hack::

Reports which types of data are currently selected in the 'Clear browsing data' settings UI. Note: some of the data types included in this API are not available in the settings UI, and some UI settings control more than one data type listed here.

.. api-header::
   :label: Return type (`Promise`_)


   .. api-member::
      :type: object

      .. api-member::
         :name: ``dataRemovalPermitted``
         :type: (:ref:`browsingData.DataTypeSet`)

         All of the types will be present in the result, with values of :code:`true` if they are permitted to be removed (e.g., by enterprise policy) and :code:`false` if not.


      .. api-member::
         :name: ``dataToRemove``
         :type: (:ref:`browsingData.DataTypeSet`)

         All of the types will be present in the result, with values of :code:`true` if they are both selected to be removed and permitted to be removed, otherwise :code:`false`.


      .. api-member::
         :name: ``options``
         :type: (:ref:`browsingData.RemovalOptions`)



   .. _Promise: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

.. api-header::
   :label: Required permissions

   - :permission:`browsingData`

.. rst-class:: api-main-section

Types

DataTypeSet

.. api-section-annotation-hack::

A set of data types. Missing data types are interpreted as false.

.. api-header::
   :label: object


   .. api-member::
      :name: [``cache``]
      :type: (boolean, optional)

      The browser's cache. Note: when removing data, this clears the *entire* cache: it is not limited to the range you specify.


   .. api-member::
      :name: [``cookies``]
      :type: (boolean, optional)

      The browser's cookies.


   .. api-member::
      :name: [``downloads``]
      :type: (boolean, optional)

      The browser's download list.


   .. api-member::
      :name: [``formData``]
      :type: (boolean, optional)

      The browser's stored form data.


   .. api-member::
      :name: [``history``]
      :type: (boolean, optional)

      The browser's history.


   .. api-member::
      :name: [``indexedDB``]
      :type: (boolean, optional)

      Websites' IndexedDB data.


   .. api-member::
      :name: [``localStorage``]
      :type: (boolean, optional)

      Websites' local storage data.


   .. api-member::
      :name: [``passwords``]
      :type: (boolean, optional)

      Stored passwords.


   .. api-member::
      :name: [``pluginData``]
      :type: (boolean, optional)

      Plugins' data.


   .. api-member::
      :name: [``serverBoundCertificates``]
      :type: (boolean, optional)

      Server-bound certificates.


   .. api-member::
      :name: [``serviceWorkers``]
      :type: (boolean, optional)

      Service Workers.


RemovalOptions

.. api-section-annotation-hack::

Options that determine exactly what data will be removed.

.. api-header::
   :label: object


   .. api-member::
      :name: [``cookieStoreId``]
      :type: (string, optional)

      Only remove data associated with this specific cookieStoreId.


   .. api-member::
      :name: [``hostnames``]
      :type: (array of string, optional)

      Only remove data associated with these hostnames (only applies to cookies and localStorage).


   .. api-member::
      :name: [``originTypes``]
      :type: (object, optional)

      An object whose properties specify which origin types ought to be cleared. If this object isn't specified, it defaults to clearing only "unprotected" origins. Please ensure that you *really* want to remove application data before adding 'protectedWeb' or 'extensions'.

      .. api-member::
         :name: [``extension``]
         :type: (boolean, optional)

         Extensions and packaged applications a user has installed (be _really_ careful!).


      .. api-member::
         :name: [``protectedWeb``]
         :type: (boolean, optional)

         Websites that have been installed as hosted applications (be careful!).


      .. api-member::
         :name: [``unprotectedWeb``]
         :type: (boolean, optional)

         Normal websites.



   .. api-member::
      :name: [``since``]
      :type: (`Date <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date>`__, optional)

      Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the :code:`getTime` method of the JavaScript :code:`Date` object). If absent, defaults to 0 (which would remove all browsing data).