/    Sign up×
Community /Pin to ProfileBookmark

Navigator language script not working with Firefox

Hi all,

I have a javascript code which makes redirection according to the navigator language of the browser. It works fine with IE and Opera but not working with FireFox.

Please help.

Ceyhun

<SCRIPT LANGUAGE=”JavaScript1.2″>
var language = navigator.userLanguage
if (language.indexOf(‘en’) > -1) document.location.href = ‘main_en.html’;
else if (language.indexOf(‘en-us’) > -1) document.location.href = ‘main_en.html’;
else
document.location.href = ‘main_tr.html’;
</SCRIPT>

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@FangSep 26.2007 — In Fx use:navigator.language
Copy linkTweet thisAlerts:
@telmessosauthorSep 26.2007 — thank you fang. how will I separate them. I am not good at javascript I don't know how to write.

if navigator is ie or opera ... else if navigator is firefox ...

in javascript.

thanks.
Copy linkTweet thisAlerts:
@FangSep 26.2007 — var language = (navigator.userLanguage)? navigator.userLanguage : navigator.language;
Copy linkTweet thisAlerts:
@telmessosauthorSep 26.2007 — thank you fang it works fine. ?
×

Success!

Help @telmessos spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...