# 3rd-cookie-check

> Check if current browser is blocking 3rd party cookies or not

Latest version **2.0.4** (published 2024-04-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install 3rd-cookie-check
pnpm add 3rd-cookie-check
yarn add 3rd-cookie-check
bun add 3rd-cookie-check
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2024-04-14 |
| First published | 2021-05-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 75.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | davidtranjs |
| Maintainers | dungmidside |
| Keywords | cookie |

## Links

- npm: https://www.npmjs.com/package/3rd-cookie-check
- Repository: https://github.com/davidtranjs/3rd-cookie-check
- Homepage: https://github.com/davidtranjs/3rd-cookie-check#readme
- Issues: https://github.com/davidtranjs/3rd-cookie-check/issues
- npm.io page: https://npm.io/package/3rd-cookie-check

## Recent versions

- 2.0.4 (latest) — 2024-04-14
- 2.0.3 — 2024-04-13
- 2.0.2 — 2024-04-13
- 2.0.1 — 2021-06-06
- 2.0.0 — 2021-05-15
- 1.0.2 — 2021-05-13
- 1.0.1 — 2021-05-09
- 1.0.0 — 2021-05-09

## README

# 3rd cookie check

[![NPM version](https://badgen.net/npm/v/3rd-cookie-check)](https://www.npmjs.com/package/3rd-cookie-check)
![Node.js CI](https://github.com/davidtranjs/3rd-cookie-check/workflows/Build%20and%20Deploy/badge.svg)
[![NPM Weekly Downloads](https://badgen.net/npm/dw/3rd-cookie-check)](https://www.npmjs.com/package/3rd-cookie-check)
[![License](https://badgen.net/npm/license/3rd-cookie-check)](https://www.npmjs.com/package/3rd-cookie-check)

This is a library that help you check current browser support "Third party cookie" or not

<img src="https://davidtranjs.github.io/3rd-cookie-check/cookie-setting.png" width="800" alt="cookie setting image"/>

### Issue 404 not found

For anyone encounter issue like [this](https://github.com/davidtranjs/3rd-cookie-check/issues/1) in version `2.0.0`. Their are 2 solutions:

1. Upgrade to latest version (current is `2.0.3`).
2. Pass below value to `iframeSrc`

```javascript
cookieCheck({ 
    iframeSrc: 'https://davidtranjs.github.io/3rd-cookie-check/readcookie.html' 
}).then(function(result) {
    const { supported, timeout } = result;
    // Your code here
})
```
### Checklist
- [ ] Support safari
- [ ] Add tested browser information 

### Installation
```bash
# npm
npm install --save 3rd-cookie-check`
# or yarn
yarn add 3rd-cookie-check
```
### Usage
```javascript
import cookieCheck from '3rd-cookie-check';

cookieCheck().then(function(result) {
    const { supported, timeout } = result;
    // Your code here
})
```
### Parameters
```javascript
cookieCheck(parametersObject)
```
All parameters is optional

| Param | Type | Describe | Default value |
| ----- | -------- | ----------- | ------------- |
| timeout  | number | Timeout in milisecond | 1000 |
| eventCode | object | { supported: string, unsupported: string }<br>Use this when use need to change the browser event message for third party cookie feature | <code>{<br/>&nbsp;&nbsp;supported: "3pc.supported", <br>&nbsp;&nbsp;unsupported: "3pc.unsupported" }</code>
| iframeSrc | string | In case you need to use your own page for check cookie <br>This URL domain must be difference from your app domain, this make sure browser fire third cookie event message| https://davidtranjs.github.io/3rd-cookie-check/checkpage.html|

### Return value
An Promise that resolve with a object have 2 properties:
- `supported` - boolean - indicate browser support status. Return `false` if timeout  
- `timeout` - boolean - default `false` - `true` if timeout was triggered

### Changes
1.0.1
- First version of package

1.0.2
- Fix not correct result response - Correct iframe src 

2.0.0
- Change returned object
- Add support for custom iframe src with `iframeSrc` parameter

2.0.3
- Change default `iframeSrc` as I changed my github username from `dungmidside` to `davidtranjs`

2.0.4
- Correct default `iframeSrc`

---
_Source: https://npm.io/package/3rd-cookie-check · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
