Page 1 of 1

Show modal dialog only once a day

Posted: Sat May 09, 2020 2:38 am
by alex4orly
I started a new project here : https://squadron-125.org.il/home.php

I have a modal dialog showing up on loading the site, but- can I somehow set it so that it only does it once a day for any user visiting the site several times on the same day, otherwise, I feel it becomes a nuisance...

Cheers

Re: Show modal dialog only once a day

Posted: Sat May 09, 2020 6:53 am
by Pablo
There is no standard solution for this but I think this should be possible with cookies.

This template has cookie script.
http://www.wysiwygwebbuilder.com/suppor ... outme.html

Re: Show modal dialog only once a day

Posted: Sat May 09, 2020 7:11 am
by alex4orly
1) I visited the site from the link, it is not your picture.... Just kidding
2) I though about setting a cookie for 1 days, then checking if it is there

But, I have no idea, how to call from the home page, another html file that has inside it my dialog.
I can go the other way - only if there is no cookie, or it is but expired - only then load this other Modal dialog

But, how do I do that without a redirect, just stay on the home page...

Thanks

Re: Show modal dialog only once a day

Posted: Sat May 09, 2020 9:22 am
by Pablo
The template has a script with a cookie.
You can change the script so the cookie is only valid for a day.

For example:

Code: Select all

document.cookie = "cookienotice=true; max-age=60*60*24; path=/";   

Re: Show modal dialog only once a day

Posted: Sat May 09, 2020 9:39 am
by alex4orly
Sorry, I am not clear, which template?
There was a url to a page, where can I get the template?
Thanks

Re: Show modal dialog only once a day

Posted: Sat May 09, 2020 10:22 am
by Pablo

Re: Show modal dialog only once a day

Posted: Sat May 09, 2020 12:46 pm
by alex4orly
Thanks again

Will look at it and report back

Cheers

Re: Show modal dialog only once a day

Posted: Sun May 10, 2020 2:28 am
by alex4orly
Works very well for me

Thanks again