We accept safe and secure Credit Card and PayPal Payments.
 
Perl Scripts

All Count
Attachment Mailer
Perl Scripts Build A FAQ Plus
Perl Scripts Clock In Center
eBackup Automated
Easy Poll
eSurvey
Fetch a File
Form Maker
Mailing List Server
MySQL Mate
PDF Creation
QCart
Quick Fix
Quote of the day
Speed Search
Task Manager
Traffic Pack
Upload Plus
Upload Gold
Upload Pro
Website Manager

 
Free Perl Downloads

Free Perl Scripts Main Page
Free Perl Scripts 404 Alerter
AccessLog Viewer
Build A FAQ
PHP Scripts eBackup
Free PHP Scripts ErrorLog Viewer
eVars - Server Info
HT Pass Creator
Upload Lite
Website Manager

 
JavaScripts

Free Java Scripts Alert Boxes
Free JavaScripts Browser Sniffer
Check email
Generators
Slide Show
Sudoku
Window Maker
More...

 
Extra Utilities

ASP Scripts Ascii Codes
Free ASP Scripts Color Picker
Font Finder
HT Pass Creator
Meta Cloak
Meta Magic
Pano Zooms
SlideShow
Server Size

 
Online Tutorials

Free HTML Scripts Glossary
Free HTML Scripts HTML
JavaScript
MySQL
SSI
Build Traffic
Other

 
Miscellaneous

About Us
Graphics
Testimonials
Installations
Latest versions

 
Hawk Eye in Tennis

Should Hawk Eye replace linesmen and lineswomen at all tennis tournaments?







 
View all Polls

Run Polls on your site

Run your own Surveys

 
Store Download FAQs Contact Us Support Programming Policies  
JavaScripts :: Cookies :: Redirection Cookie

This small javascript allows you to set a cookie on your visitors computer. If the cookie still exists the next time they visit, they are redirected to the page of your choice. Ideal for redirecting visitors who have already seen you (long) flash intro or your popup windows. Tested on Mac and PC in Netscape, Opera and IE. Simply copy the following JavaScript to your document. There are two variables you can set. These are go_to, which is the URL your visitor should be redirected to, and num_days which is the number of days the cookie should remain on your visitor's computer. Once the cookie has expired, the process begins again. That is, the next time the visitor hits the page, the cookie is set and waits for the visitor's next hit.

The Script

<script>
<!--
/* Copyright http://www.perlscriptsjavascripts.com 
   Free and commercial Perl and JavaScripts     */
   
// page to go to if cookie exists
go_to = "http://www.perlscriptsjavascripts.com";

// number of days cookie lives for
num_days = 60;
function ged(noDays){
    var today = new Date();
    var expr = new Date(today.getTime() + noDays*24*60*60*1000);
    return  expr.toGMTString();
}

function readCookie(cookieName){
    var start = document.cookie.indexOf(cookieName);
    if (start == -1){ 
        document.cookie = "seenit=yes; expires=" + ged(num_days);
    } else {
        window.location = go_to;
    }
}

readCookie("seenit");
// -->
</script>
Changing days to hours

If you would like the cookie to expire immediately or in a matter of hours or minutes, you can make the following modifications :

To have the cookie expire immediately, set the num_days variable to a negative number. Eg.

num_days = -1;

To have the cookie expire in a matter of hours, remove the *24 from the ged (Get Expiration Date) function. The num_days = 5; variable will now be the number of hours. For your information, the rest of the figures mean, times 60 seconds, times 60 minutes, times 1000 milliseconds.

Select All   De-select
Speed Search our site
Survey Software
Create unlimited web based surveys on your website from your website

Website Monitoring with SMS TXT alerts

Discounted Scripts
Subscribe to our periodial newsletter to receive special offers.

Bathroom Hygiene
How often do you thoroughly clean your bathroom?








View all Polls

Run Polls just like this one on your website!


About us | Contact us | Script FAQs | Script Support | Website Hosting | Our Policies | Store | Testimonials
Subscribers log in here. Subscribe to our periodical newsletter for special offers on commercial scripts, hosting, exciting business opportunities, and industry news and events. Our Mailing List Software is powered by Consolidator    
HTML Plain text
©1999 - 2015 All content Copyright PerlScriptsJavaScripts.com Proudly hosted by LinuxHostingPlans.com