Check if user is online

This commit is contained in:
smartfridge 2021-05-04 10:54:28 +02:00
parent 15eb2f867f
commit 5e57963192
2 changed files with 22 additions and 2 deletions

View file

@ -63,5 +63,25 @@
<source src="https://discord.com/assets/0bdc0497eb3a19e66f2b1e3d5741634c.webm" type="video/webm"> <source src="https://discord.com/assets/0bdc0497eb3a19e66f2b1e3d5741634c.webm" type="video/webm">
</video> </video>
</body> </body>
<p id=checkOnline></p>
<script>
var ifConnected = window.navigator.onLine;
if (ifConnected) {
document.getElementById("checkOnline").innerHTML = "🟢Online";
document.getElementById("checkOnline").style.color = "green";
} else {
document.getElementById("checkOnline").innerHTML = "🔴 Check your internet connection!";
document.getElementById("checkOnline").style.color = "red";
}
setInterval(function(){
var ifConnected = window.navigator.onLine;
if (ifConnected) {
document.getElementById("checkOnline").innerHTML = "🟢Online";
document.getElementById("checkOnline").style.color = "green";
} else {
document.getElementById("checkOnline").innerHTML = "🔴 Check your internet connection!";
document.getElementById("checkOnline").style.color = "red";
}
}, 3000);
</script>
</html> </html>

View file

@ -40,7 +40,7 @@ app.whenReady().then(() => {
session session
.fromPartition("some-partition") .fromPartition("some-partition")
.setPermissionRequestHandler((webContents, permission, callback) => { .setPermissionRequestHandler((webContents, permission, callback) => {
const url = webContents.getURL(); const url = webContents.getURL(); //unused?
if (permission === "notifications") { if (permission === "notifications") {
// Approves the permissions request // Approves the permissions request