Answer the question
In order to leave comments, you need to log in
How to make a module window appear periodically on the page?
It is necessary that the module window periodically appear on the page, the module window itself is not a problem, but how to make time intervals, for example, every hour or 30 minutes. That is, an hour passed for the module window to appear.
Answer the question
In order to leave comments, you need to log in
Out of loyalty to users, I won’t specifically tell you how to do this.
I hate those stupid modals.
Since the site is not a SPA, the method with setTimeout will not help, it is necessary to write the current time on the first page load (timeFromCookie = Date.now() - for example), in the cookie or localStorage - in order to then take this time and compare it with the current one, and watch how long has passed: (Date.now()- timeFromCookie) / (1000 * 60 * 30) > 1 - if the expression is true, then more than half an hour has passed. To compare, you can write a function using setInterval, which, say, once a minute will check the current time and the time from the storage. And run it immediately when the page loads.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question