hide onload popup after page second time refresh

I want to hide onload popup after page second time refresh.

HTML:

<div class='popup'>
<div class='cnt223'>
<button type="button" class="close previous">&times;</button>
<div>
<img src="assets/images/homepopup.jpg" alt="image" class="img-responsive"/>
</div>
<p class="text-center">
<br/>
Do You Want To Upgrade Your Profile?
<br/>
</p>
<span style="color:#F00;"><i class="fa fa-exclamation-triangle" style="font-size:16px;"></i>&nbsp;Please Do Not Share Your User ID, Password & OTP To Any One.</span>
 <div id="msform">
  <input type="button" name="cancel" class="previous action-button-previous" value="Remind Me Later" style="width:155px;"/>
                <input type="submit" name="submit" class="previous action-button" value="I Want To Upgrade" style="width:155px;"/>
                </div>

</div>
</div>

<script type='text/javascript'>
$(function(){
var overlay = $('<div class="overlay"></div>');
overlay.show();
overlay.appendTo(document.body);
$('.popup').show();
$('.previous').click(function(){
$('.popup').hide();
overlay.appendTo(document.body).remove();
return false;
});
$('.x').click(function(){
$('.popup').hide();
overlay.appendTo(document.body).remove();
return false;
});
});

</script>
Suraiya ParvinAsked:
Who is Participating?
 
mohan singhWeb developerCommented:
Try this

You can use localstorage. It is easy to understand and use
$(document).ready(function() {
    var isshow = localStorage.getItem('isshow');
    if (isshow== null) {
        localStorage.setItem('isshow', 1);

        // Show popup here
        $('#jPopup').show();
    }
});

Open in new window


It will show you the popup at first visit of your site.

https://stackoverflow.com/questions/32155036/show-jquery-popup-only-at-first-visit-of-a-page
0
 
Suraiya ParvinAuthor Commented:
thank you so much @mohan singh for you answer
1
 
mohan singhWeb developerCommented:
Hi @ Suraiya Parvin
above code is working or not


Regards
Mohan SIngh
0
 
mohan singhWeb developerCommented:
It works good
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.