Based on the link you’ve shared, if you want a popup over any desktop application through the browser, use the W3C Notification API. For example
window.onload = function () {
if (Notification.permission !== "granted")
Notification.requestPermission();
};
function notifyMe() {
if (!Notification) {
alert('Desktop notifications not available in your browser. Try Chromium.');
return;
}
if (Notification.permission !== "granted")
Notification.requestPermission();
else {
var notification = new Notification('Notification title', {
icon: 'Notification icon',
body: "Notification body",
});
notification.onclick = function () {};
}
}
and call the notifyMe()
using the navigator online variable. For example
setInterval(function () {
if (navigator.onLine)
notifyMe();
}, 1000);
This will check whether user is connected to internet every 1 second and display a popup if true.
See https://developer.mozilla.org/en/docs/Online_and_offline_events
solved Display an alert visible if the user is using the web or not