Skip to content Skip to sidebar Skip to footer

Javascript Redirect Based On Referrer?

Is there anyway to grab the referring URL using javascript, lets say the reffering url is http://page.com/home?local=fr, then redirect a user to a new page with the same local as t

Solution 1:

if (document.referrer != "") {
   var referringURL = document.referrer;
   var local = referringURL.substring(referringURL.indexOf("?"), referringURL.length);
   location.href = "http://page.com/login" + local; 
}

Post a Comment for "Javascript Redirect Based On Referrer?"