browserinterface
interface
Provides access to specific browser methods that asynchronously execute in the top frame (cookie
, ,
)
Anchor to propertiesProperties
This object replaces the native document.cookie API and provides a setter/getter to set cookies on the top frame.
Anchor to localStorage
localStorage
Anchor to sessionStorage
sessionStorage
Anchor to sendBeacon
sendBeacon
(url: string, body?: string) => Promise<boolean>
Deprecated
The navigator.sendBeacon() method asynchronously sends an HTTP
POST request containing a small amount of data to a web server. Please use
the standard web fetch
api with the option keepalive: true
to achieve
this functionality.
Was this section helpful?
Accessing Standard Api
/**
* browser.cookie.get(name)
*
* @param {name} - String representing the name of the cookie
* @return {Promise} - Promise of type string
*/
const user_id = await browser.cookie.get('my_user_id');
/**
* browser.cookie.set(name)
*
* @param {name} - String representing the name of the cookie
* @param {value} - String representing the value of the cookie
* @return {Promise} - Promise of type string
*/
browser.cookie.set('my_user_id', 'ABCX123');
browser.cookie.set('my_user_id=ABCX123; expires=Thu, 18 Dec 2013 12:00:00');