Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
103
rated 0 times [  105] [ 2]  / answers: 1 / hits: 7893  / 10 Years ago, mon, june 30, 2014, 12:00:00

I have never worked with browser caching before and am unable to find a good tutoiral on google. Below I am using the jQuery plugin Lightbox_me http://buckwilson.me/lightboxme/ to display a pop up window when the page loads. Can anyone direct me to a tutorial to only display something on the users first visit or is it simple enough to show me a demonstration? Can this be done using java-script?



 <script>
jQuery(function() {
function launch() {
jQuery('#sign_up').lightbox_me({centered: true, onLoad: function() { jQuery('#sign_up').find('input:first').focus()}});
}

jQuery(document).ready(function() {
jQuery(#sign_up).lightbox_me({centered: true, preventScroll: true, onLoad: function() {
jQuery(#sign_up).find(input:first).focus();
}});
e.preventDefault();
});
});
</script>


<div id=sign_up style=display:none;>
pop up box!
</div>


My problem is I only want this pop up to display the first time the user visits the page, then cache that so it wont display again when user returns to site.


More From » html

 Answers
23

Simply putting this code in all your pages:



<script>
if (!localStorage['someName']) {
localStorage['someName'] = 'yes';
myFunction();
}
</script>


Just to figure it out, here is a nice explanation about localStorage: http://diveintohtml5.info/storage.html


[#44213] Sunday, June 29, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dayanaracolleeng

Total Points: 7
Total Questions: 96
Total Answers: 104

Location: Mayotte
Member since Mon, Sep 12, 2022
2 Years ago
dayanaracolleeng questions
Wed, Jul 20, 22, 00:00, 2 Years ago
Sat, Dec 11, 21, 00:00, 3 Years ago
Sun, Jun 27, 21, 00:00, 3 Years ago
Wed, Jan 27, 21, 00:00, 3 Years ago
;