Forum Moderators: open
Thanks again,
Herenvardö
auto refresh to the /english/index.htm
to auto refresh you can insert this html tag in your index.htm
<META HTTP-EQUIV="REFRESH" CONTENT="0; URL=english/index.htm">
adjust the content=0 to any number of seconds ie 1, 2, 3 etc if you want to give your visitors time to read an intro or something first before the redirect.
For the second question, I have implemented a system on my site (url in profile) for the same purpose, the pages however need to be in asp.
If that's what you are looking for, I can explain.
Debian is running this to serve a multitude of translations, the Debian web site has more info.
As for the root-level page, a simple 301 redirect with ASP to the default language would be by far the best solution.
<script language="javascript" type="text/javascript">
var loc=(location.href);
var getit=new Array();
var getit=loc.split('english/');
var filename=getit;
document.write("<a href='http://yoursite.com/spanish/")
document.write(filename[1])
document.write("'>Spanish Version</a>")
</script>
to change to the english version, use something like this:
<script language="javascript" type="text/javascript">
var loc=(location.href);
var getit=new Array();
var getit=loc.split('spanish/');
var filename=getit;
document.write("<a href='http://yoursite.com/english/")
document.write(filename[1])
document.write("'>English Version</a>")
</script>
by clicking on the link the user will be redirected to a page in the folder of the other language. the file has the same name as the one the link is on. it also works if the file is in a subdirectory!
var brwsr=navigator.appName;
if(brwsr=="Netscape" ¦¦ brwsr=="Opera")
var language=navigator.language; else
var language=navigator.browserLanguage;
if(language){language=language.substring(0,2);}
if(language == "de") window.location = "indexdeutsch.html";
else window.location = "indexenglish.html"; filenames not the ones I use
[httpd.apache.org...]
<META HTTP-EQUIV="REFRESH" CONTENT="0; URL=english/index.htm">
sebbothebutcher:
Your code fits exactly to my problem! Thanks a lot. I'll have to modify it a littel but hope that will work.
bull:
Thanks, but I want to send EVERYBODY to the english version, and then they will switch to spannish if thew want. Don't ask me the reasons, I only do what my boss asks. Even so, good code. I'll probably use it in my home page if someday I make it multilanguage.
If you're running Apache
encyclo & tombola:
Your answers are interesting, but i'll go on with sebbothebutcher's code: it fits exactly my needs without complications... exactly wath my boss likes :P
EVERYBODY:
Thanks a lot! :)
Herenvardö
PS: I love these forums: everybody always ready to help someone;).