Halloween Sale 15% off Ends in See the plans
HTML

"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.

Don’t have WPIDE yet? Install it on your site

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

  1. Install WPIDE on your WordPress site (it is free) and open Code Snippets.
  2. Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
  3. It is added inactive: review the code and settings, then switch it on.

Have a snippet worth sharing?

Publish it to the library from WPIDE or right here. Sign in with any WordPress site that runs WPIDE, free or Pro. Public snippets are reviewed by the WPIDE team before they appear.

Which site should get this snippet?

Enter the address of your WordPress site. WPIDE opens there in a new tab with the snippet ready to review and save.

Remembered in this browser only, so you are asked once.

Report this snippet

Tell the WPIDE team what is wrong: broken code, something harmful, spam or copied work.