Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How, with jQuery do I tell if a website visitor has been to the site before?

I want create a div container with a message for first time visitors to my site. Visitors will read it and click a 'Hide' button to dissapear it forever.

How is this done?

like image 920
Zander Avatar asked Apr 16 '09 14:04

Zander


1 Answers

What about using the Cookie plugin for jQuery?

$.cookie('the_cookie', 'the_value'); // Create a session cookie ("the_cookie") and set its value to "the_value"
$.cookie('chocolate_chip_cookie', 'the_value', { // create a cookie with all available options
    expires: 7, // expires in seven days
    path: '/', // accessible from the whole site...
    domain: 'jquery.com',
    secure: true // ...but only on a secure connection
});
$.cookie('the_cookie', null); // delete the session cookie
like image 70
moff Avatar answered Nov 15 '22 00:11

moff