title: Open a popup window on Magento home page once when user open a site
body: <p>I want to open a popup in homepage once every time when a user visits a site.
  The problem is now popup appears every time when reload the homepage. I just want to show this popup once.</p>
  <pre><code> &lt;?php $currentUrl = Mage::helper('core/url')-&gt;getCurrentUrl();
   if($currentUrl=='http://website.com/')
   {
   ?&gt;
  &lt;form action=&quot;&lt;?php echo $this-&gt;getUrl('subscribe/index/subscriptionsave/'); ?&gt;&quot; id=&quot;subscribeForm&quot; method=&quot;post&quot;&gt;
  &lt;div id=&quot;boxes&quot;&gt;
    &lt;div id=&quot;dialog&quot; class=&quot;window&quot;&gt;
      &lt;div id=&quot;popupfoot&quot;&gt;  &lt;a class=&quot;agree&quot; href=&quot;#&quot;&gt;close&lt;/a&gt; &lt;/div&gt;
      &lt;div class=&quot;popupcontentbox&quot;&gt;
          &lt;div class=&quot;box_content&quot;&gt;
              &lt;h2&gt;Stay in the loop!!&lt;/h2&gt;
              &lt;p&gt;Be the first one to know about new arrivals,
  fresh offers &amp;  fashion updates.&lt;/p&gt;
           &lt;div class=&quot;book-column-left&quot;&gt;
          &lt;?php /*?&gt; &lt;label class=&quot;f&quot;&gt;Email Address&lt;span&gt;*&lt;/span&gt;&lt;/label&gt;&lt;?php */?&gt;
           &lt;input type=&quot;text&quot; class=&quot;input-text required-entry validate-email&quot; placeholder=&quot;Email Address *&quot;  name=&quot;emailid&quot; id=&quot;emailid&quot;&gt;
            &lt;/div&gt;
             &lt;input type=&quot;submit&quot; name=&quot;sub&quot; value=&quot;Submit&quot; class=&quot;btn&quot;&gt;
             &lt;div class=&quot;offer_text&quot;&gt;Get flat 20% Off on your First purchase. Use coupon &quot;INDULGE20&quot;.&lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
    
    &lt;/div&gt;
    &lt;div id=&quot;mask&quot;&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/form&gt;
   &lt;?php } ?&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
  //&lt;![CDATA[
      var subscribeForm = new VarienForm('subscribeForm', true);
  //]]&gt;
      &lt;/script&gt;
  
  
  
  &lt;script src=&quot;//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js&quot;&gt;&lt;/script&gt; 
      &lt;?php */?&gt;&lt;script&gt;
      jQuery(document).ready(function() { 
      var id = '#dialog'; 
      //Get the screen height and width
      var maskHeight = jQuery(window).height();
      var maskWidth = jQuery(window).width();
          
      //Set heigth and width to mask to fill up the whole screen
      jQuery('#mask').css({'width':maskWidth,'height':maskHeight});
       
      //transition effect
      jQuery('#mask').fadeIn(500);    
      jQuery('#mask').fadeTo(&quot;slow&quot;,0.9); 
          
      //Get the window height and width
      var winH = jQuery(window).height();
      var winW = jQuery(window).width();
                    
      //Set the popup window to center
      jQuery(id).css('top',  winH/2-jQuery(id).height()/2);
      jQuery(id).css('left', winW/2-jQuery(id).width()/2);
          
      //transition effect
      jQuery(id).fadeIn(2000);    
          
      //if close button is clicked
      jQuery('.window .agree').click(function (e) {
      //Cancel the link behavior
      e.preventDefault();
      
      jQuery('#mask').hide();
      jQuery('.window').hide();
      });
      
      //if mask is clicked
      jQuery('#mask').click(function () {
      jQuery(this).hide();
      jQuery('.window').hide();
      });
          
           
      jQuery(window).scroll(function() {    
              
      var scroll = jQuery(window).scrollTop();
              if(scroll &gt; 300){
                  jQuery(&quot;.gotop&quot;).addClass(&quot;active&quot;);
              }else if(scroll &lt; 300){
                  jQuery(&quot;.gotop&quot;).removeClass(&quot;active&quot;);
              }
      
              
          });
          
          jQuery('.gotop').click(function(){
          jQuery(&quot;html, body&quot;).animate({ scrollTop: 0 }, 700);
              return false;
           });
      });
      &lt;/script&gt;
  </code></pre>