views:

97

answers:

1

I am using the script called ModalBox. I want to display the ModalBox on page load the first time a visitor reaches my site. Every time after the first visit the modalbox should not display again. How can I do this?

I have set up a testing page. Please Visit this page to view my code.
Testing Site

The code that I am using to pop up the ModalBox on page load is:

body onLoad="Modalbox.show('pages/modalbox_page.html', {width: 460, title: 'Sending status'}); return false;"
+1  A: 

To do this you need a mechanism to persist the fact that a user has visited your site, the best available mechanism for this is to use a cookie - if there's no cookie (or no flag in the cookie data) then the user hasn't been here before so you need to show the dialog and set the cookie.

This mechanism isn't perfect, it can only log that the current user of a specific machine using the current browser is visiting for the first time and it also depends on the user/system accepting persistent cookies which not all do - but it is the mechanism you need to use to do the job.

Murph