sandshakimi
asked on
Disable Modal Window After Initial Page Load ?
This code displays the Welcome modal window on page load on the Landing page, and also when the page is refreshed.
The Visitor only needs to see it once as they navigate the site and return back to the Landing page.
What's the code to have it viewed just once for the Visitor?
The Visitor only needs to see it once as they navigate the site and return back to the Landing page.
What's the code to have it viewed just once for the Visitor?
</noscript>
<script>
$('#welcomeModal').modal('show');
$("#file-3").fileinput({
browseClass: "btn btn-warning ",
showUpload: true,
showRemove: false,
showCaption: false,
fileType: "any"
});
$(".btn-warning").on('click', function() {
if ($('#file-4').attr('disabled')) {
$('#file-4').fileinput('enable');
} else {
$('#file-4').fileinput('disable');
}
});
</script>
<noscript>
modal12.PNG
ASKER
Is there a benefit to do this serve side wth PHP, or should I also consider JavaScript?
ASKER
Gary, can you explain the code.
So within the same browser session, the Visitor will return to the Landing page, but will not see the modal again? Which is the objective.
So within the same browser session, the Visitor will return to the Landing page, but will not see the modal again? Which is the objective.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
You may want a longer-term memory of the cookie. This article gives the general design pattern. I think it could be adapted for a modal window, just as it is used for a "splash" page.
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_3314-How-to-Show-an-Introductory-Web-Page-Once-Using-PHP.html
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_3314-How-to-Show-an-Introductory-Web-Page-Once-Using-PHP.html
ASKER
Gary, so with this approach, on their next visit the User will not see the modal?
1) What if they clear their browser history prior to visiting a second time?
2) Or visit with a different browser on thier second visit?
3) Or view in phone, tablet first time, second time?
1) What if they clear their browser history prior to visiting a second time?
2) Or visit with a different browser on thier second visit?
3) Or view in phone, tablet first time, second time?
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Open in new window