How do I load lightbox as soon as someone visits the website?

  • Profile Image
    liyam
    Answered on May 31, 2011 at 11:12 AM

    Hello Jentoronto,

    There is a way for your form to pop-up once the page loads up.  The only difficult part is figuring out how to make it load depending on if the visitor has already filled up the form or not, unless you are planning to use PHP coding with authentication or something that will tell that the user is logged in, you do not need to show up the form.

    Here's the sample code for making your feedback form script pop-up once the page is visited:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
        <title>Contact Us</title>
    </head>
    <body onload="document.getElementById('lightbox-11493338180').click()">
    <script src="//www.jotform.com/min/g=feedback" type="text/javascript">
    new JotformFeedback({
    formId:'11493338180',
    base:'http://www.jotform.com/',
    windowTitle:'Contact us',
    background:'#FFA500',
    fontColor:'#FFFFFF',
    type:2,
    height:570,
    width:700
    });
    </script>
    <input id="lightbox-11493338180" style="display:none" type="submit" value="lightbox" > </body>
    </html>

    I have highlighted the important parts that you should take note of:

    1. The onload event property inside the body tag
    2. I have changed the anchor tag (<a id=...>) to an input tag.  This way, the onload event will be able to mimick the click of the mouse on an input tag.

    As for your show-only-once-per-user option, this is quite difficult to accomplish as you will need to validate the user via authentication before you could put up a condition to show the form or not.  Another option is to use cookies but this situation is quite different as this will show the form once only from one computer browser instead of one visitor.

    If you would like to consider the cookie based option, just let me know.

    -Liyam

  • Profile Image
    jentoronto
    Answered on May 31, 2011 at 07:06 PM

    ...

  • Profile Image
    NeilVicente
    Answered on May 31, 2011 at 07:56 PM

    Hi,

    That is because you have another feedback form embedded in your site. Go find the other feedback code and delete it.

    That should fix it.


    Neil

  • Profile Image
    jentoronto
    Answered on May 31, 2011 at 07:57 PM

    Yup, fixed. Thanks so much!

  • Profile Image
    okcomputer
    Answered on April 05, 2012 at 12:35 PM

    Hi I just implemented the pop up lightbox with thanks to your information above. I would however really appreciate your Cookie Based Solution to avoid it popping up every single time the user visits the site

    http://www.franoptionsinc.com

  • Profile Image
    fxr
    Answered on April 05, 2012 at 12:37 PM

    There is a cookie based solution described outlined in this User Guide Article

  • Profile Image
    anudeep
    Answered on July 03, 2012 at 07:40 AM

    i tried with this but came like this can any body solve this

    screenshot.jpg

  • Profile Image
    liyam
    Answered on July 03, 2012 at 07:45 AM

    Hello, anudeep.  Can you try again to give us the link to the screenshot?  The image did not appear properly from your post.