Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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