Quantcast
Viewing latest article 1
Browse Latest Browse All 4

Answer by Zawiszor for How to set a cache with Local Storage

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Example</title></head><body><div id="ads_box">        Hi..I am a ads..<span id="close_ads">Close ads and don't show unit for 24 hours</span></div><script>        var dontShowUntil = new Date(new Date().getTime() + 60 * 60 * 24 * 1000);        document.getElementById("close_ads").addEventListener("click", function () {            localStorage.dontShowUntil = dontShowUntil;            document.getElementById('ads_box').style.display = 'none';        });        if (new Date(localStorage.dontShowUntil) > new Date()) {            document.getElementById('ads_box').style.display = 'none';        }</script></body></html>

Viewing latest article 1
Browse Latest Browse All 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>