1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-05-29 09:28:06 +02:00
CanvasBlocker/test/navigatorTest.js

56 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-02-27 23:49:00 +01:00
2019-12-16 19:27:28 +01:00
const createLog = function(){
2019-02-27 23:49:00 +01:00
"use strict";
2019-12-16 19:27:28 +01:00
const div = document.getElementById("log");
2019-02-27 23:49:00 +01:00
return function createLog(){
2019-12-16 19:27:28 +01:00
const logDiv = document.createElement("div");
2019-02-27 23:49:00 +01:00
logDiv.className = "log";
div.appendChild(logDiv);
return function createLine(str){
2019-12-16 19:27:28 +01:00
const logLine = document.createElement("div");
2019-02-27 23:49:00 +01:00
logLine.className = "logLine";
logDiv.appendChild(logLine);
logLine.textContent = str;
return function updateLine(str){
logLine.textContent = str;
};
};
};
}();
2019-12-16 19:27:28 +01:00
let log = createLog();
2019-02-27 23:49:00 +01:00
2019-11-30 02:05:37 +01:00
log("user agent equal between server and client: " + (
document.getElementById("serverUserAgent").text === navigator.userAgent
));
2019-02-27 23:49:00 +01:00
Object.keys(navigator.__proto__).sort().forEach(function(property){
"use strict";
2019-12-16 19:27:28 +01:00
const value = navigator[property];
2019-02-27 23:49:00 +01:00
if ((typeof value) === "string"){
log(property + ": " + value);
}
});
2019-05-22 23:39:56 +02:00
2019-12-16 19:27:28 +01:00
const section = document.createElement("h2");
2019-05-22 23:39:56 +02:00
section.textContent = "Values in iFrame";
document.getElementById("log").append(section);
log = createLog();
2019-12-16 19:27:28 +01:00
const iframe = document.createElement("iframe");
2019-05-22 23:39:56 +02:00
document.body.appendChild(iframe);
2019-12-16 19:27:28 +01:00
const iframeWindow = frames[frames.length - 1];
2019-05-22 23:39:56 +02:00
Object.keys(navigator.__proto__).sort().forEach(function(property){
"use strict";
2019-12-16 19:27:28 +01:00
const value = iframeWindow.navigator[property];
2019-05-22 23:39:56 +02:00
if ((typeof value) === "string"){
log(property + "@iframe: " + value);
}
});
document.body.removeChild(iframe);