-
-
Save Ghepes/464dc57e06890198e450a8da773206d2 to your computer and use it in GitHub Desktop.
nonce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- EXEMPLE css nonce CSP --> | |
| <link rel="stylesheet" media="all" href="https://domain.a.com/a/file/style.css" nonce=""> | |
| <!-- EXEMPLE js nonce CSP --> | |
| <script nonce=""> | |
| // Codul scriptului | |
| </script> | |
| <!-- EXEMPLE js nonce CSP --> | |
| <script src="index-file.js" nonce=""></script> | |
| <!-- EXEMPLE nonce --> | |
| function createStyleSheet(media, nonce) { | |
| // Create the <style> tag | |
| var style = document.createElement("style"); // style.setAttribute("type", "text/css"); | |
| // Add a media (and/or media query) here if you'd like! | |
| // style.setAttribute("media", "screen") | |
| // style.setAttribute("media", "only screen and (max-width : 1024px)") | |
| if (media) { | |
| style.setAttribute("media", media); | |
| } // Add nonce attribute for Content Security Policy | |
| if (nonce) { | |
| style.setAttribute("nonce", nonce); | |
| } // WebKit hack :( | |
| // style.appendChild(document.createTextNode("")); | |
| // Add the <style> element to the page | |
| <!-- EXEMPLE nonce --> | |
| var tns = function (options) { | |
| options = extend({ | |
| nonce: false | |
| }, options || {}); | |
| var doc = document, | |
| }, | |
| sheet = createStyleSheet(null, getOption('nonce')), | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment