I need to limit the light box to once per browser session

  • Malletsme
    Asked on February 2, 2017 at 8:07 PM

    Hi,

    I created a light box form. YAY! I read your article on how to delay it opening for a time. I chose 30 seconds. I've also ready your article on how to use cookies to limit the light box to once per browser session. I can't get the two to mix. I need help please :).

    I've pasted my code here so that you can see what I've done. I need to know how to limit this light box to once per browser session.

     <script src="https://form.jotform.com/static/feedback2.js?3.3.REV" type="text/javascript"> var JFL_70316619337154 = new JotformFeedback({ formId: '70316619337154', base: 'https://form.jotform.com/', windowTitle: 'HCB Pop Up', background: '#FFA500', fontColor: '#FFFFFF', type: '2', height: 500, width: 700, openOnLoad: false }); </script> <a id="lightboxdelay" class="btn lightbox-70316619337154" style="margin-top: 16px;display:none;"> HCB Pop Up </a>

    <script language="JavaScript">

    var delayseconds = 30;

        function pause() {

        myTimer = setTimeout('whatToDo()', delayseconds * 1000)

        }

       function whatToDo() {

    document.getElementById('lightboxdelay').click();

        }

    window.onload = pause;

    </script>

     

    Thanks so much!

    John

  • jonathan
    Replied on February 2, 2017 at 11:12 PM

    Hi John,

    Were you able to actually make the once per browser session code work?

    I could not see it working when checked on your website page.

    Please clarify first if the solution using the guide did work on your test page already.

    --

    I also recommend reviewing this discussion thread about the same feature.

    On that discussion, our colleague Charlie have a working test page here.

    Hope this help. Let us know how we can be of further assistance.