Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run once popup window

Status
Not open for further replies.

annettesteinr

Programmer
Sep 28, 2000
5
SE
Hi,
Does anyone have experience with a 'runonce' popup window?
This window should appear the first time the customer comes to this page and force a 'Accept' before they can continue.
Regards, Annette
 
i would use a cookie - the first time the user accesses the site the asp code checks for a particular cookie if it already exists then the popup would not be shown else it would be shown:

Code like:

<%
Dim strCookie, boolShowPopUp
boolShowPopUp = FALSE
If(Request.Cookies(&quot;ShowPopUp&quot;).HasKeys) Then
boolShowPopUp = Request.Cookies(&quot;ShowPopUp&quot;)(&quot;VisitedBefore&quot;)
Else
Response.Cookies (&quot;ShowPopUp&quot;)(&quot;VisitedBefore&quot;) = &quot;TRUE&quot;
End If
%>

<%
If ( boolShowPopUp) Then
%>
<script>
window.open();
</script>
<%
End If
%>

Obviously this works only if user has cookies & javascript enabled and they use the same machine each time. An alternative would be to write a flag to a database if they have visited before the flag would be set to false else true and the popup would be shown.

Hope this helps a bit





 
weller100 is right if you only want to display the popup once EVER!
If you want to disply it each time a user starts a session on your site, you might want to put some code in the session_start_event in global.asa... This is not a bug - it's an undocumented feature...
;-)
 
Thank's for the help!
I wanted to avoid cookies, because my user should confoim a contract when opening my site. This should the user only do while the first login, not from other machines also.
I solved it by storing the login date. If login date is empty I show the message.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top