// Open timer popup var result = window.open( location.protocol + "//" + location.host + "/popup" + location.search, "PopupTimer" + Date.now(), "width=250,height=100,menubar=no,toolbar=no,location=no,status=no,resizable=no,scrollbars=no" ); // Show warning if it didn't work if (!result) { document.getElementById("popup-warning").style.display = "block"; document.getElementById("refresh").onclick = function() { location.reload(); } } else { window.onfocus = function() { history.back(); } }