Argh, just an additional question regarding working around inline javascript:
What would be the correct solution to correct this rejected inline js:
<a href=# onclick="dothis(1)"><div id=field style='position: absolute; left: -100%; bottom: 120px; vertical-align: middle; text-align: center; display: inline-block; width: 40%; height: 30px; padding: 5px; background-color: #4ab73c; border-radius: 5px;'>Text</div></a>
Error: [Error] Refused to execute a script for an inline event handler because ‘unsafe-inline’ does not appear in the script-src directive of the Content Security Policy. (video_overlay.html, line 73)
the function dothis() does this:
function dothis(number){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
}
};
xhttp.open("POST", "https://www.website.com/post.php", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("number="+number);
document.getElementById("field").style.backgroundColor = "#000000";
stop_animating();
}