开发者

ModalBox display only once sitewide

开发者 https://www.devze.com 2022-12-12 22:54 出处:网络
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

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/m开发者_如何学Goodalbox_page.html', {width: 460, title: 'Sending status'}); return false;"


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号