Skip to content

Instantly share code, notes, and snippets.

@manish2788
Created July 13, 2020 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manish2788/6889806f714068a2fdcf5ef11214c9c5 to your computer and use it in GitHub Desktop.
Save manish2788/6889806f714068a2fdcf5ef11214c9c5 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/nacizar/41
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta http-equiv="Content-Security-Policy" content="
default-src 'none';
connect-src 'self';
font-src 'self';
img-src data: 'self' https://static.jsbin.com;
media-src 'none';
object-src 'none';
script-src 'self' https://code.jquery.com https://static.jsbin.com 'unsafe-inline';
style-src 'self' https://static.jsbin.com;
frame-src 'self'
"/>
<title>JS Bin</title>
</head>
<body>
<h1>CSP Violation while using jQuery UI!</h1>
<h2 id="message"></h2>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
<script id="jsbin-javascript">
var scrollBarWidth = $.position.scrollbarWidth();
document.addEventListener('securitypolicyviolation', function(e) {
document.getElementById("message").innerText = "CSP Error blocked the execution. Violated Directive "+e.violatedDirective;
});
document.getElementById("message").innerText = "Scroll Bar Width:"+scrollBarWidth;
</script>
<script id="jsbin-source-javascript" type="text/javascript">var scrollBarWidth = $.position.scrollbarWidth();
document.addEventListener('securitypolicyviolation', function(e) {
document.getElementById("message").innerText = "CSP Error blocked the execution. Violated Directive "+e.violatedDirective;
});
document.getElementById("message").innerText = "Scroll Bar Width:"+scrollBarWidth;
</script></body>
</html>
var scrollBarWidth = $.position.scrollbarWidth();
document.addEventListener('securitypolicyviolation', function(e) {
document.getElementById("message").innerText = "CSP Error blocked the execution. Violated Directive "+e.violatedDirective;
});
document.getElementById("message").innerText = "Scroll Bar Width:"+scrollBarWidth;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment