How to display a one-time popup ad

Posted on 2004-11-21
Last Modified: 2008-03-06
I'd like to know how this popup ad was created/displayed.

Also, how can I make sure that a visitor only sees it once when they hit my homepage?
Question by:gmahler5th
    LVL 31

    Assisted Solution

    <%if session("popup") <> "no" then
    session("popup") = "no"
    <%end if%>
    LVL 31

    Expert Comment

    That will only displaty the popup once, based on session variable.
    LVL 3

    Accepted Solution

    You could also set a cookie, if you like.  Set a cookie on the users PC, so when that user visits your site again, you will check for the cookie.  If it is there, don't show the popup.

    Kind of the same as alorentz commented, but using a cookie instead.

    This example creates a cookie that counts the number of times each person has visited your site. It will also expire in 10 days from thier last visit.


    response.cookies("popup").Expires = date + 10
    if num = "" then
          response.cookies("popup") = 1
          response.cookies("popup") = num + 1
    end if

    if response.cookies("popup") < 1 then
    response.cookies("popup") = "no"
    <%end if%>

    This way, they will see the popup again after 10 visits to your site...or whatever number you set.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
    I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now