Show jQuery popup only first time visit of website page?

diffrence btw

Here are the way to show popup for first time visit and the difference between them are..
 
1) Localstorage – Assigned value stored after browser close.
2) SessionStorage – Assigned value removed after browser or tab close.

 

1) Localstorage  

Localstorage value can be removed by deleting the cache of browser.

/// show div first time
var isshow = localStorage.getItem('isshow');
if (isshow== null) {
localStorage.setItem('isshow', 1);
// Show popup here
setTimeout(function(){
jQuery('#letcont').modal('show');
},5000);
}

 
2) SessionStorage  
Assigned value removed after browser or tab close

/// show div first time
var isshow = sessionStorage.getItem('isshow');
if (isshow== null) {
sessionStorage.setItem('isshow', 1);
// Show popup here
setTimeout(function(){
jQuery('#letcont').modal('show');
},5000);

 

Modal or content to show

Add this code to theme footer.php file ..
 
<div id="letcont" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Contact Us</h4>
</div>
<div class="modal-body"> <?php echo do_shortcode('

Error: Contact form not found.

');?> </div>
</div>
</div>
</div>

 
You can change the Contact form 7 shortcode to your one code.

 

To help contact use here.

If this help you then.. Can you buy a Cup of Coffee for me by nst webcreation paypal--OR-- nst webcreation blog coffee cup

Published by

NST

Myself Narender Singh Thakur ( NST ) and i share my Experience/Knowledge and Tricks for folks and beginners to solve their issues while making websites through this Planet.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Click to Chat