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
- Host: GitHub
- URL: https://github.com/deadcoder0904/generate-hash-inline-script
- Owner: deadcoder0904
- Created: 2018-10-14T07:10:35.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-15T15:05:26.000Z (over 7 years ago)
- Last Synced: 2025-01-14T13:18:11.117Z (about 1 year ago)
- Topics: chrome-extension, chrome-extensions, content-security-policy, csp, hash, inline, inline-script
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 :)