"You Are Offline" Notice
Shows a small notice at the bottom of the screen when the visitor loses their internet connection and hides it when the connection returns, so failed clicks make sense.
Opens WPIDE on
Code
<div class="wpide-offline" role="status" aria-live="polite" hidden>You are offline. Some features may not work until your connection is back.</div>
<style>
.wpide-offline{position:fixed;left:50%;bottom:16px;transform:translateX(-50%);z-index:100001;max-width:calc(100vw - 32px);padding:10px 16px;border-radius:8px;background:#1d2327;color:#fff;font-size:14px;box-shadow:0 6px 20px rgba(0,0,0,.25);}
.wpide-offline[hidden]{display:none;}
</style>
<script>
(function () {
var note = document.querySelector('.wpide-offline');
if (!note) { return; }
function update() { note.hidden = navigator.onLine !== false; }
window.addEventListener('online', update);
window.addEventListener('offline', update);
update();
})();
</script>
Notes
Edit the message text in the HTML.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.