[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

How to display a one-time popup ad

I'd like to know how this popup ad was created/displayed.

http://www.devcity.net/forums/topic.asp?tid=83614

Also, how can I make sure that a visitor only sees it once when they hit my homepage?
0
gmahler5th
Asked:
gmahler5th
  • 2
2 Solutions
 
alorentzCommented:
<%if session("popup") <> "no" then
session("popup") = "no"
%>
<script>
window.open("yourpopup.asp")
</script>
<%end if%>
0
 
alorentzCommented:
That will only displaty the popup once, based on session variable.
0
 
Insomniac_PhDCommented:
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
num=request.cookies("popup")
if num = "" then
      response.cookies("popup") = 1
else
      response.cookies("popup") = num + 1
end if

if response.cookies("popup") < 1 then
response.cookies("popup") = "no"
%>
<script>
window.open("yourpopup.asp")
</script>
<%end if%>

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

Cheers!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now