Categories:

Home / Free JavaScripts / Other / Here

Cut & Paste "Please bookmark my site" alert!

Credit: JavaScript Kit

Description: This is a script that reminds your surfers to bookmark your site whenever he/she leaves the page. To avoid over-irritating your surfers, the message appears only the first time the surfer enters and leaves the page; if he/she goes to CNN for a while, then returns and leaves again, the message is not displayed. (Try leaving this page the first time- a message will be displayed. Come back, then leave again- no message!).

Note: This script uses cookies to keep track of the number of times the user has entered/left the page, thus, the browser the surfer is using must to cookie enabled to see any message at all.

Example:

Directions

Step 1: Add the below to the <head> section of your page:

Step 2: Add the below onunload event handler to the <body> tag, as follows:

<body onunload="bookmarkme()">


JavaScript Tools:
Site Info

CopyRight 1998-2012 JavaScript Kit. NO PART may be reproduced without author's permission.