wext-httpspluschecker/popup/dnssec.js
2018-05-16 18:47:22 +02:00

38 lines
1.0 KiB
JavaScript

var xhr = new XMLHttpRequest();
browser.tabs.query({ active: true, lastFocusedWindow: true }).then(function(tab) {
const url = new URL(tab[0].url);
if (url.protocol === "http:" || url.protocol === "https:" ) {
var host = url.hostname ;
xhr.open('GET', 'https://httpspluschecker.virtit.fr/?domain=' + host, false);
xhr.send();
value = JSON.parse(xhr.responseText);
if (value['DNSSEC'] === true ) {
document.getElementById("dnssec").className = "success";
} else {
document.getElementById("dnssec").className = "danger";
}
if (value['DANE'] === true ) {
document.getElementById("dane").className = "success";
} else {
document.getElementById("dane").className = "danger";
}
if (value['HSTS'] === true ) {
document.getElementById("hsts").className = "success";
} else {
document.getElementById("hsts").className = "danger";
}
if (value['HPKP'] === true ) {
document.getElementById("hpkp").className = "success";
} else {
document.getElementById("hpkp").className = "danger";
}
}
});