An annoying automatic pop-up window

Source: Internet
Author: User

A pop-up window is used to display the questionnaire form. It is considered as the most convenient and convenient way to collect and access user information. When the first questionnaire was prepared, we politely asked people if they were willing to fill out the table, but the results were disappointing. Therefore, we decided to put this questionnaire form on our homepage. When people visit it, it will pop up automatically, and the effect was unexpectedly good.

The following are the secrets of success:
1: the automatic pop-up window can only be displayed once, regardless of whether the user has filled in the questionnaire form.
2: the automatic pop-up window does not affect the display speed of the home page.
3: the automatic pop-up window automatically disappears after the user fills out the questionnaire form.
4: the pop-up window is displayed in the upper left corner of the screen.
5: do not add advertisement in the automatic pop-up window, because our goal is to get the user's survey report.

To determine whether a window is displayed, we use a small cookie. We define a cookie that can be used multiple times and determine multiple pop-up windows. We name this cookie "S", which contains the IDs of all pop-up windows.
Now, when a user accesses the home page, we determine whether the request ID is included in the cookie. If the cookie does not exist, we will pop up the window and write the cookie to prevent the window from popping up again.
In the following example, we write cookies on the server, which can be implemented using JavaScript. We select the server because it is relatively simple.
At the beginning of our homepage, let's execute ASPCode. This code should be placed before HTML output, because we need to edit the header.
<%
Dim bsurvey 'show Questionnaire
Const bid = "1" 'survey id

Bsurvey = false
'Check whether the survey table has been shown
If instr (request. Cookies ("S"), ":" & Bid & ":") = 0 then
'The survey table is not displayed. Update cookie

'Set the cookie expiration time to 60 days
Response. Cookies ("S"). expires = dateadd ("D", 60, now ())
'Set the path
Response. Cookies ("S"). Path = "/"
'Write cookie
Response. Cookies ("S") = request. Cookies ("S") & ":" & Bid &":"

Bsurvey = true
End if
%>

We provide an ID for each survey table. If you have multiple pop-up windows, you can easily output them in a planned manner.

We add an ASP script at the end of the page to determine whether the pop-up window is displayed. This script is at the end of the page and does not affect the download speed of the home page. This script is very simple. It uses window. open () to open a new window.

<% If bsurvey then %>
<SCRIPT>
Window. Open ("/survey/displaysurvey. asp? Q = "& bid," survey "," width = 350, Height = 400, Top = 0, Left = 0, scrollbars = yes ")
</SCRIPT>
<% End if %>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.