-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
19 lines (18 loc) · 888 Bytes
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => {
let url = tabs[0].url;
async function getStatus(url) {
const response = await fetch("https://surfguardsays.onrender.com/getStatus?url="+url).then((res) => res.json());
const output = JSON.parse(response);
if (output == '-1') {
document.getElementById("status").innerHTML = "This link is safe to surf ✔️";
document.getElementById("status_image").src="/safe.jpg";
} else {
document.getElementById("status").innerHTML = "This link may not be safe to surf ❌";
document.getElementById("status_image").src="/unsafe.jpg";
}
// document.getElementById("url").innerHTML = output;
}
getStatus(url);
console.log(response.body)
// document.getElementById('url').innerHTML = url;
});