Age Verification Script using JQuery439
Pages:
1
![]() |
LiquidLayer private msg quote post Address this user | |
Age Verification on Age-restricted Website using jQuery UI Datepicker October 17, 2012 If you own a website which contains adult content, you may want to confirm if a visitor is of the age required before showing the content. A common way to do this is by asking the visitor his/her Date Of Birth. This post will show how you can accomplish this using jQuery UI’s Datepicker. As an overview, this is how our Age Verification works: 1. Ask the user to pick his/her Date Of Birth. 2. Check if the user’s age is of the legal age we specified. 3. If the user is of legal age, add a cookie that this user is already verified so that there is no need to verify again on his/her next visit. Then, display the website’s age-restricted content, or redirect to the page with the age-restricted content. 4. If the user does not meet the age requirement, display a message that he/she is not allowed to view the content. View Demo here: http://jquerywall.com/demo-age-verification-jquery-ui-datepicker Download Source here: http://jquerywall.com/jquery-download/age-verification-jquery-ui-datepicker.zip Read More Here: http://jquerywall.com/age-verification-jquery-ui-datepicker/ Mods to send under age users to a web site: William Crane I have tested your datepicker. It is fine up to a point. However, should an invidual not be of the required age, I would like them to be redirected away for the website. How can I do this? Rich Replace $(“#minor-content”).show(); in the index page with the following. window.location.replace(“http://yourdomain.com”); |
||
Post 1 IP flag post |
![]() |
LiquidLayer private msg quote post Address this user | |
If you just want to display / Are you 18 years of age or older - Here is a jQuery tutorial that does just that: http://www.techerator.com/2010/09/how-to-perform-age-verification-with-jquery-and-cookies-mmm-cookies/ How to Perform Age Verification with jQuery and Cookies (mmm, cookies) If you’re a freelance developer, chances are good that you’ll encounter a situation where you’ll have to make some content “off limits” to the kids. In most cases, such as with alcohol-related material, this is required by law. So, how do you do it? Well, if you’re using jQuery, the answer is “easily.” The first thing that may jump to your mind is that Javascript is not fail-safe. This is true; all a user needs to do is disable Javascript in his or her browser, and any sort of Javascript-based security measure is rendered useless. Luckily, legal requirements for online age verification recognize this and acknowledge that it is entirely (at least for now) dependent on the honor of the user. However, if your particular situation requires a verification system that is a bit more robust, consider using sessions which are supported in both ASP and PHP. In this example, I will illustrate a scenario where the user is prompted with the question “Are you at least 18 years of age?” Of course, this tutorial can be extended to prompt the user for specific birth dates. For this tutorial, you will need: jQuery: http://docs.jquery.com/Downloading_jQuery jQuery Cookies: http://plugins.jquery.com/project/Cookie I’m going to let you download those as I go grab a coffee. Are we ready? OK, let’s roll. Before anything else, we’ll need to create two pages: one will be the “verification” page while the other will represent every page that has an age restriction in place. In both pages we’ll need to include a relative link to the two jQuery files that will be handling the cookies. Look at the snippet below and copy/paste it within the <head> region of each page. For more: http://www.techerator.com/2010/09/how-to-perform-age-verification-with-jquery-and-cookies-mmm-cookies/ |
||
Post 2 IP flag post |
Pages:
1