1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-03 12:06:31 +02:00

Added navigator protection

This commit is contained in:
kkapsner 2019-02-27 23:49:00 +01:00
parent 479ee74903
commit e56df7160f
23 changed files with 711 additions and 1 deletions

View file

@ -17,6 +17,7 @@
<li><a href="detectionTest.html">Detection test</a></li>
<li><a href="performanceTest.html">Performance test</a></li>
<li><a href="webGL-Test.html">Support for webGL</a></li>
<li><a href="navigatorTest.php">Navigator test</a></li>
<li><a href="settingsLoading.php">Settings loading</a></li>
</ul>
</body></html>

34
test/navigatorTest.js Normal file
View file

@ -0,0 +1,34 @@
var createLog = function(){
"use strict";
var div = document.getElementById("log");
return function createLog(){
var logDiv = document.createElement("div");
logDiv.className = "log";
div.appendChild(logDiv);
return function createLine(str){
var logLine = document.createElement("div");
logLine.className = "logLine";
logDiv.appendChild(logLine);
logLine.textContent = str;
return function updateLine(str){
logLine.textContent = str;
};
};
};
}();
var log = createLog();
log("user agent equal between server and client: " + (serverUserAgent === navigator.userAgent));
Object.keys(navigator.__proto__).sort().forEach(function(property){
"use strict";
var value = navigator[property];
if ((typeof value) === "string"){
log(property + ": " + value);
}
});

23
test/navigatorTest.php Normal file
View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>Navigator test</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="testIcon.svg" type="image/png" rel="icon">
<link href="testIcon.svg" type="image/png" rel="shortcut icon">
</head>
<body>
<h1>Navigator test</h1>
Tests the navigator properties.
<div id="log">
<div class="log">
<div class="logLine">
server site user agent: <?php echo htmlentities($_SERVER["HTTP_USER_AGENT"], ENT_QUOTES, "UTF-8");?>
</div>
</div>
</div>
<script>
var serverUserAgent = <?php echo json_encode($_SERVER["HTTP_USER_AGENT"]);?>;
</script>
<script src="navigatorTest.js"></script>
</body></html>