Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@exponent/electron-cookies

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@exponent/electron-cookies

Provides document.cookie support for Electron

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
632
increased by66.32%
Maintainers
1
Weekly downloads
 
Created
Source

electron-cookies

Provides document.cookie support for Electron

Installation

npm install @exponent/electron-cookies --save

Usage

import ElectronCookies from '@exponent/electron-cookies';

// Add support for document.cookie, using the given origin (protocol, host, and
// port)
ElectronCookies.enable({
  origin: 'https://example.com',
});

// Remove support for document.cookie. Cookies are not cleared from the
// underlying storage.
ElectronCookies.disable();

Behavior

When getting or setting a cookie, the browser needs to know the current URL of the page.

In Electron, HTML files are usually served from the local filesystem, which has no domain. electron-cookies provides you a way to specify the origin of the URL to use:

ElectronCookies.enable({ origin: 'https://example.com' });

This tells electron-cookies the origin of the URL to use when accessing cookies. The path of the URL is the relative path from the app's root to the path of the HTML file. So if the app is at /Users/you/Desktop/ and the HTML file is at /Users/you/Desktop/web/index.html, the synthesized URL will be https://example.com/web/index.html.

Alternatively, if you omit an origin, the full file: URL of the HTML file is used instead.

FAQs

Package last updated on 29 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc