PDA

View Full Version : Javascript


lachiep
09-28-2002, 06:29 PM
Does anyone know a javascript that will:

-Redirect surfers to Different Pages depending on their nationality(domains of hosts)



would greatly be aprreciated...

lachie

RockerHard
09-28-2002, 06:39 PM
You mean the Host Redirect (http://www.kastle.net/products/hostredirect) script by KLS? I think it's perl though :(

Aheib
09-28-2002, 06:40 PM
Why not use htaccess instead?
It's faster, works when javascript is disabled,
and costs way less bandwith...
If you want, I can hook you up with the code to do this...
Must have it around here somewhere

lachiep
09-28-2002, 06:40 PM
Aheib ...

yeah thatd be great!

Easy_R
09-29-2002, 08:28 AM
try it in PHP :)

<?
if (eregi('pl',$HTTP_ACCEPT_LANGUAGE)) {
header('Location: polska.html');
exit; }
if (eregi('en',$HTTP_ACCEPT_LANGUAGE)) {
header('Location: anglia.html');
exit; }
if (eregi('de',$HTTP_ACCEPT_LANGUAGE)) {
header('Location: niemcy.html');
exit; }
if (eregi('ja',$HTTP_ACCEPT_LANGUAGE)) {
header('Location: japonia.html');
exit; }
if (eregi('fr',$HTTP_ACCEPT_LANGUAGE)) {
header('Location: francja.html');
exit; }
if (eregi('nl',$HTTP_ACCEPT_LANGUAGE)) {
header('Location: holandia.html');
exit; }
header('Location: default.html');
?>

Binghiman
09-29-2002, 03:11 PM
Can obviousley be done in many ways ... but as you asked for JavaScript to begin with, you can try this:

<SCRIPT>
if (navigator.appName == 'Netscape')
var language = navigator.language;
else
var language = navigator.browserLanguage;
if (language.indexOf('en') > -1) document.location.href = 'www.english-sponsor.com';
else if (language.indexOf('es') > -1) document.location.href = 'www.spanish-sponsor.com';
else if (language.indexOf('de') > -1) document.location.href = 'www.german-sponsor.com';
else if (language.indexOf('fr') > -1) document.location.href = 'www.french-sponsor.com';
else if (language.indexOf('it') > -1) document.location.href = 'www.italian-sponsor.com';
else if (language.indexOf('nl') > -1) document.location.href = 'www.dutch-sponsor.com';
else if (language.indexOf('sv') > -1) document.location.href = 'www.swedish-sponsor.com';
else if (language.indexOf('da') > -1) document.location.href = 'www.danish-sponsor.com';
else if (language.indexOf('no') > -1) document.location.href = 'www.norwegian-sponsor.com';
else if (language.indexOf('fi') > -1) document.location.href = 'www.finnish-sponsor.com';
else
document.location.href = 'http://www.pay-per-click.com';
</SCRIPT>

lachiep
09-29-2002, 04:37 PM
cheers fellas :P