473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Automatic Language Selection by IP

I applied the code as mentioned in:
http://javascript.about.com/library/bllang.htm


so when a Dutch-speaking visitor (nl being the ISO-code for Dutch language) visits my site, he should automaticly be redirected to the index-nl.htm page

but what it returns is:
www.mywebsite-nl.com

instead of:
www.mywebsite.com/index-nl.htm

can someone please adapt to make it work?

many thx!
Mar 31 '08 #1
1 2093
gits
5,390 Expert Mod 4TB
here is an example:

Expand|Select|Wrap|Line Numbers
  1. var langCode  = navigator.language || navigator.systemLanguage;
  2. var lang      = langCode.toLowerCase(); 
  3. lang          = lang.substr(0,2);
  4.  
  5. var dest = window.location.href;
  6. var re   = /(.\w+)$/;
  7. var ext  = dest.match(re)[1];
  8. dest     = dest.replace(re, '-' + lang) + ext;
  9.  
that simply assumes that your start-page is 'index.html' ...

kind regards
Mar 31 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Paul M. | last post by:
Hi, we have 2 www systems one which we wrote ourselves the other is a parent company one over which we have no control. The 2nd system involves the user having to enter a username & password in a...
1
by: petermichaux | last post by:
Hi, I have been experimenting with some textarea automatic resize scripts. Most that I have found count the number of characters in the textarea and divide by the number of columns. This works...
11
by: Xah Lee | last post by:
Of interest: • The Semicolon Wars, by Brian Hayes. 2006. http://www.americanscientist.org/template/AssetDetail/assetid/51982 in conjunction to this article, i recommend: • Software...
10
by: Immortalist | last post by:
Various aquisition devices that guide learning along particular pathways towards human biases. And as E.O. Wilson might say mental development appears to be genetically constrained. (1) Language...
0
by: robert | last post by:
I'm looking for an efficient optimizer on a noisy high-dimensional and costly function. My own GA hack seems to be somewhat stiff and I find me trying too much around with different cooling speeds...
7
by: ThunderMusic | last post by:
Hi, Ok, I find myself having a lot of troubles with URL Rewriting and I've seen on the net that in some situations, indexers have difficulty indexing sites because of some flaws in the url...
2
by: bryars | last post by:
I want to write some SQL which results in an automatic conversion of a datetime to a string in a format suitable for the Language of the connection (either by explicitly setting the Language in the...
9
by: Brett_A | last post by:
I have a form where the first field is a dynamic drop-down that pulls from a db (Access). The fields associated with the query are task_id, task_name and task_rate. The field has the value of...
25
by: sidd | last post by:
In the following code: int i = 5; ---it goes to .data segment int j; ---it goes to bss segment int main() { int c; int i = 5; ---stack
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.