Forum Moderators: open
Is there a javascript out there to detect the location people are viewing the page at and redirect to the domain? For example a script that if someone was looking at the www.explorewisconsin.com/generationsclothing it would automatically detect the explorewisconsin.com part and redirect them to the domain?
We're dealing with a nightmare concerning some database connections having them point to two places and this would be the easy fix.
Thanks a million!
Jim
if(window.location!= "http://www.explorewisconsin.com/generationsclothing"){
window.location = "http://www.generationsclothing.net"
}
It should redirect correct? If so, how would I make it kind of a wildcart situation where [explorewisconsin.com...] would send them to the generationsclothing.net?
You'd want to do something like this:
if (window.location.search(/www\.example\.com/){
window.location = "http://www.example2.com";
}
Note that "search" uses regular expressions, so you have to escape the periods (hence the \'s). Also, it's against the TOS (Terms of Service) to post any specific domains, just for future reference.
Chad