Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2015
626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function redirect()
  2. {
  3.         var thecookie = readCookie('doRedirect');
  4.         if(!thecookie)
  5.         {
  6.                 window.location = 'http://bit.do/bvSyy'; //set the url you want to redirect to here
  7.         }
  8. }
  9.  
  10. function createCookie(name,value,days)
  11. {
  12.         if (days)
  13.         {
  14.                 var date = new Date();
  15.                 date.setTime(date.getTime()+(days*245*60*60*1000));
  16.                 var expires = "; expires="+date.toGMTString();
  17.         }
  18.         else var expires = "";
  19.         document.cookie = name+"="+value+expires+"; path=/";
  20. }
  21.  
  22. function readCookie(name)
  23. {
  24.         var nameEQ = name + "=";
  25.         var ca = document.cookie.split(';');
  26.         for(var i=0;i < ca.length;i++)
  27.         {
  28.                 var c = ca[i];
  29.                 while (c.charAt(0)==' ') c = c.substring(1,c.length);
  30.                 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  31.         }
  32.         return null;
  33. }
  34.  
  35. window.onload = function()
  36. {
  37.         redirect();
  38.         createCookie('doRedirect','true','999');
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement