Skip to content

deadcoder0904/generate-hash-inline-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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 -

<script>alert('Yo Yo Yo!')</script>

then replace script variable in index.js like -

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

& type in terminal

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 :)

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published