Current location: Hot Scripts Forums » General Web Coding » JavaScript » help in closing a page itself


help in closing a page itself

Reply
  #1 (permalink)  
Old 11-23-11, 11:43 AM
shakeebfarhat shakeebfarhat is offline
New Member
 
Join Date: Nov 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Question help in closing a page itself

i have a script which enable me to redirect the visitor to the GOOGLE.COM if they r viewing the page 2nd time in a day with same ip....what i want to do this rather to redirect to the GOOGLE.COM they page itself close if a visitor is viewing the page 2nd time in a day...HERE IS THE SCRIPT

Quote:
<script language ='javascript'>
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

/* Check the cookie and redirect if they have it set. */

sWhere = 'http://google.com'; // replace this with where you want them to be sent when they can't view page.

if(!readCookie('viewcheck')){
createCookie('viewcheck',1,1);
} else {
window.location = sWhere;
}
</script>
PLEASE GUYZZ HELP ME....!!!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] multiple forms in a single page id10tn00b HTML/XHTML/XML 2 10-08-08 11:26 PM
[turnkey] Lyrics site - $149 (LEGAL) rightinpoint General Advertisements 0 10-22-06 04:33 AM
Suppress Sound in IE when a new Page Loads immortal_king JavaScript 3 10-11-06 08:04 PM
Classified Ads skipper23 Perl 3 11-22-05 02:22 AM
$_GET variable from previous page! truesilentassassin PHP 6 07-26-04 09:55 PM


All times are GMT -5. The time now is 02:08 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.