An open API service indexing awesome lists of open source software.

https://github.com/deadcoder0904/generate-hash-inline-script

Generate Hash for Inline Script when using Chrome Extensions due to Content Security Policy (CSP) error
https://github.com/deadcoder0904/generate-hash-inline-script

chrome-extension chrome-extensions content-security-policy csp hash inline inline-script

Last synced: 3 months ago
JSON representation

Generate Hash for Inline Script when using Chrome Extensions due to Content Security Policy (CSP) error

Awesome Lists containing this project

README

          

# generate-hash-inline-script

> Generate Hash for Inline Script while using Chrome Extensions due to Content Security Policy (CSP) errpr ❌

## But, why?

Because I faced this problem while making [Meta Preview](https://twitter.com/deadcoder0904/status/1048129409885122560)

## Usage

Just replace the `script` variable in `index.js` with the contents of your inline script & run `index.js`

## Example

If your inline script is like -

```js
alert('Yo Yo Yo!')
```

then replace `script` variable in `index.js` like -

```js
const script = `alert('Yo Yo Yo!')`;
```

& type in terminal

```bash
node index.js
```

Voila, it will copy the hash to the clipboard.

## Credits

All the credits go to https://stackoverflow.com/a/38554505/6141587

I just tweaked a little to copy it to clipboard :)