Rudi
Rudi

Reputation: 75

Only one popup per visits... Help Me

I have a site using javascript popup effect like this:

<script type="text/javascript">
     var GB_ROOT_DIR = "greybox/";
</script>
<script src="greybox/AJS.js" type="text/javascript"></script>
<script src="greybox/AJS_fx.js" type="text/javascript"></script>
<script src="greybox/gb_scripts.js" type="text/javascript"></script>
<link href="greybox/gb_styles.css" type="text/css" rel="stylesheet">
<script language="JAVASCRIPT">

function loadWindow(){
  GB_showCenter('Free Report!', 'http://www.signupformlocation.com/popup/signup.php', 420, 570);
}

window.onload = loadWindow;

     </script>

But everytime my visitor go to the homepage, my popup always shown. How to do making this popup only display one time?

Please Help me

Upvotes: 1

Views: 2058

Answers (2)

RobertPitt
RobertPitt

Reputation: 57268

Personally i would go with JStorage, its a HTML5 jQuery Plug-in the uses the local storage on most popular browsers.

Example:

var loadWindows = function()
{
    if(!$.jSotreage.get('welcome_flag'))
    {
        GB_ShowCentre('Free Support!') // Blah
        $.jStorage.set('welcome_flag',true);
    }
}

Uses JSON To serialize all data in the local storage:-

jStorage: http://plugins.jquery.com/project/jStorage

Draft: http://dev.w3.org/html5/webstorage/

Without jQuery: Storing Objects in HTML5 localStorage

You can store around 5MB Per domain so this would be benificial and should take over the use of cookies within the javascript environment.

Upvotes: 0

Sergey Eremin
Sergey Eremin

Reputation: 11080

you can use cookies and jquery

<script src="js/jquery.cookie.js" type="text/javascript"></script>
<script>
function loadWindow() {
    if ($.cookie('popup_flag') != 'true') {
        GB_showCenter('Free Report!', 'http://www.signupformlocation.com/popup/signup.php', 420, 570);
        $.cookie('popup_flag', 'true');
    }
}
</script>

Upvotes: 4

Related Questions