https://github.com/weaponsforge/thirdpartycookie
Checks if 3rd party cookies are allowed in client web browsers.
https://github.com/weaponsforge/thirdpartycookie
cookies express html third-party-cookie
Last synced: 10 months ago
JSON representation
Checks if 3rd party cookies are allowed in client web browsers.
- Host: GitHub
- URL: https://github.com/weaponsforge/thirdpartycookie
- Owner: weaponsforge
- Created: 2020-03-12T20:56:37.000Z (about 6 years ago)
- Default Branch: dev
- Last Pushed: 2022-12-12T05:05:08.000Z (over 3 years ago)
- Last Synced: 2025-03-26T09:37:12.665Z (about 1 year ago)
- Topics: cookies, express, html, third-party-cookie
- Language: HTML
- Homepage: https://thirdpartycookie.firebaseapp.com/
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## thirdpartycookie
> Checks if 3rd party cookies are allowed in client web browsers.
> Inspired by @mindmup's [3rdpartycookiecheck](https://github.com/mindmup/3rdpartycookiecheck).
### Prerequisites
1. Secure web server that runs on https and can host static html files.
2. NodeJS *(optional, if static website is to be run on localhost)*
- node version: 10.16.3
- npm version: 6.9.0
### Content
- [**Installation**](#installation)
- [**Usage**](#usage)
- [**Live Demo**](#demo)
- [**References**](#references)
## Installation
1. Clone this repository.
`git clone https://github.com/weaponsforge/thirdpartycookie.git`
2. Install dependencies (For localhost viewing only. 3rd party cookies checking won't work from files served on localhost. However, the production app can be used from localhost. See [**Usage**]() for more information).
`npm install`
3. Run the localhost server.
`npm run start`
4. Load the local website client for more usage information.
`http://localhost:3001`
5. (Optional) Upload `check.html` and `complete.html` in a secure web server that runs in https and call
"check.html" from there i.e., `https://[YOUR_SECURE_SERVER]/check.html`
## Usage
1. Create an ``.
2. Point its `src` to `https:///thirdpartycookie/check.html`. i.e.,
``
3. Listen for a window "message" event that will be issued using `window.postMessage()` from the iframe's child.
var receiveMessage = function(evt) {
if (evt && evt.origin === window.location.origin) {
if (evt.data === 'MM:3PCunsupported') {
console.log('--3RD PARTY COOKIES ARE N-O-T SUPPORTED!!')
} else if (evt.data === 'MM:3PCsupported') {
console.log('--3RD PARTY COOKIES ARE SUPPORTED')
}
}
}
window.addEventListener("message", receiveMessage, false)
## Live Demo
> **thirdpartycookie**:
> [https://thirdpartycookie.firebaseapp.com/](https://thirdpartycookie.firebaseapp.com/).
## References
[[1]](https://stackoverflow.com/questions/3550790/check-if-third-party-cookies-are-enabled) - S.O. check if third party cookies are enabled
[[2]](https://blog.zok.pw/web/2015/10/21/3rd-party-cookies-in-practice/) - 3rd party cookies in practice
[[3]](https://javascript.info/cookie) - document.cookie
@weaponsforge
20200313