Hi. I'm looking for a script, preferably a jQuery plugin, to display a modal window when entering my website (whichever page) but only once during the same browsing session, so when the user closes and reopens the browser he sees the modal window again in my website. Can somebody help me? Thanks
Use cookies ...
Look at http://plugins.jquery.com/files/jquery.cookie.js.txt
Do not use an expire value (so that the cookie is a session cookie)..
if ($.cookie('modal') != 'shown')
{
$.cookie('modal', 'shown');
// code to show modal
}
I think the easiest solution would be to set a cookie (using javascript) and show the window, and the second time around have the javascript check the content of the cookie (let's say you just store a visit count in the cookie) and decide not to show the window.
I dont see the point in cookies any more apart from server side scripting
If your using jQuery and grasping the latest Javascript Features then you should really go with HTML 5's Data Storage:
HTML5 Local Storage: http://dev.w3.org/html5/webstorage/ AND http://html5demos.com/storage
HTML5 Client Side SQL: http://webkit.org/blog/126/webkit-does-html5-client-side-database-storage/
General HTML5: http://html5demos.com/
Sorry for my late answer! I made what suggested by Gaby in conjunction with the jQuery Smart Modal script, it seems working perfectly. Thanks to all anyway