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"; } } });