Stas1985,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.modalDialog {
display: none;
}
.modalDialog.open {
display: block;
}
</style>
<script>
document.addEventListener("DOMContentLoaded", function() {
const limit = 2 * 3600 * 1000; // 2 часа
const localStorageInitTime = localStorage.getItem('localStorageInitTime') || new Date() - limit;
const delta = new Date() - localStorageInitTime;
const close = document.querySelector('.close-modalDialog');
const modalDialog = document.querySelector('.modalDialog');
const openModal = _ => modalDialog.classList.add('open');
const closeModal = _ => {
modalDialog.classList.remove('open');
localStorage.setItem('localStorageInitTime', +new Date());
window.setTimeout(openModal, limit);
};
window.setTimeout(openModal, delta >= limit ? 0 : limit - delta);
close.addEventListener('click', closeModal)
});
</script>
</head>
<body>
<div id="open" class="modalDialog">
<div>
<a href="#close" title="Закрыть" class="close-modalDialog">X</a>
<div class="hello" id="welcome-window">
<!--banner-->
banner banner
<!--banner end-->
</div>
</div></div>
<div class="clr">
</div>
</body>
</html>