How do I use javascript cookie to control the popup once per user visit?

by 4 replies
6
Hi warriors,

I was given a js code to show the popup, I inserted it into my site template, and it get loaded every time user load a new page, eventhough he click on the close button, it keep loaded every new page load, this wil get very annoyed.

The code was given to me as follow:

<script type="text/javascript" src="http://wildfireapp.com/website/302/companies/124704/widget_loader.js"></script>

I'm not a programmer, and can't figure up how to write a cookie to control this popup. I have tried to google, got some sample, but don't know how to integrate and change them to work for me. I appreciate if you can help or show me some guidance. Thank you very much in advanced.

Regards,
Lester
#programming #control #cookie #javascript #popup #user #visit
  • Not tested, but without having to manage cookies you could take a shortcut like this:

    Code:
    <?php if( !isset($_COOKIE) ) : ?>
    <script type="text/javascript" src="http://wildfireapp.com/website/302/companies/124704/widget_loader.js"></script>
    <?php endif; ?>
    This is assuming your site drops cookies of some kind of course. If that doesn't work just tie it to a specific cookie that your site drops on new visitors, like a session cookie or something.
    • [1] reply

    • Hi, thanks for your sharing, unfortunately, the popup bar still appear after you hit closing it.

      I think the best way is still using cookies, anyone can share with me the coding?

      Thanks
      • [1] reply
  • [DELETED]
  • That example is using cookies - you may need to edit it for your site as I mentioned.

Next Topics on Trending Feed