473,498 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Firefox + Javascript unable to load page

The main page of the site has this script which determines the
language settings of the OS. This works fine for IE but not for
firefox. Is there any other codes which i have to insert to make sure
Firefox would be able to load it?

<script type="text/javascript">
function detectlang()
{
var lang=navigator.userLanguage
var langs=navigator.systemLanguage
var langb=navigator.browserLanguage
if
((langs=="ar-sa"||lang=="ar-sa"||langb=="ar-sa"))
{window.location.reload("http://www.flynas.com/ara/index.html")}
else
{window.location.reload("http://www.flynas.com/eng/index.html")}
}
</script>

May 8 '07 #1
4 6026
On May 8, 9:37 am, iamaporkaho...@gmail.com wrote:
The main page of the site has this script which determines the
language settings of the OS. This works fine for IE but not for
firefox. Is there any other codes which i have to insert to make sure
Firefox would be able to load it?

<script type="text/javascript">
function detectlang()
{
var lang=navigator.userLanguage
var langs=navigator.systemLanguage
var langb=navigator.browserLanguage
if
((langs=="ar-sa"||lang=="ar-sa"||langb=="ar-sa"))
{window.location.reload("http://www.flynas.com/ara/index.html")}
else
{window.location.reload("http://www.flynas.com/eng/index.html")}}

</script>
can't you use
Options +multiviews
if on Apache?
How will you send the correct charset header from the server for
xhtml?

It is by far the best option to use the server for this kind of thing,
unless you can't which is rare! Sending a 302 is not good for page
rank either.
By the way where was the user before the reload? Surely theres only
need to redirect away from a default.

May 8 '07 #2
ASM
ia************@gmail.com a écrit :
The main page of the site has this script which determines the
language settings of the OS. This works fine for IE but not for
firefox. Is there any other codes which i have to insert to make sure
Firefox would be able to load it?
In JavaScript the normal attributes for navigator are :

alert( ' appCodeName : ' +navigator.appCodeName+
'\n appName : ' +navigator.appName+
'\n appVersion : ' +navigator.appVersion+
'\n cookieEnabled : ' +navigator.cookieEnabled
'\n javaEnabled() : ' +navigator.javaEnabled()+
'\n language : ' +navigator.language+
'\n IE userLanguage : '+navigator.userLanguage+
'\n platform : ' +navigator.platform+
'\n userAgent : ' +navigator.userAgent;
>
<script type="text/javascript">
function detectlang()
{
var lang=navigator.userLanguage
var lang = navigator.language || navigator.userLanguage;
var langs=navigator.systemLanguage
doesn't exists (except IE ?)
var langb=navigator.browserLanguage
doesn't exists (except IE ?)
if
((langs=="ar-sa"||lang=="ar-sa"||langb=="ar-sa"))
or :
if(lang == 'ar-sa' || lang.substring(0,2) = 'ar')
{window.location.reload("http://www.flynas.com/ara/index.html")}
else
{window.location.reload("http://www.flynas.com/eng/index.html")}
}
</script>


--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
May 8 '07 #3
On May 8, 1:45 pm, ASM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
iamaporkaho...@gmail.com a écrit :
The main page of the site has this script which determines the
language settings of the OS. This works fine for IE but not for
firefox. Is there any other codes which i have to insert to make sure
Firefox would be able to load it?

In JavaScript the normal attributes for navigator are :

alert( ' appCodeName : ' +navigator.appCodeName+
'\n appName : ' +navigator.appName+
'\n appVersion : ' +navigator.appVersion+
'\n cookieEnabled : ' +navigator.cookieEnabled
'\n javaEnabled() : ' +navigator.javaEnabled()+
'\n language : ' +navigator.language+
'\n IE userLanguage : '+navigator.userLanguage+
'\n platform : ' +navigator.platform+
'\n userAgent : ' +navigator.userAgent;
<script type="text/javascript">
function detectlang()
{
var lang=navigator.userLanguage

var lang = navigator.language || navigator.userLanguage;
var langs=navigator.systemLanguage

doesn't exists (except IE ?)
var langb=navigator.browserLanguage

doesn't exists (except IE ?)
if
((langs=="ar-sa"||lang=="ar-sa"||langb=="ar-sa"))

or :
if(lang == 'ar-sa' || lang.substring(0,2) = 'ar')
{window.location.reload("http://www.flynas.com/ara/index.html")}
else
{window.location.reload("http://www.flynas.com/eng/index.html")}
}
</script>

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
I did as suggested and remove navigator.browserLanguage &
navigator.systemLanguage from the script. It is still not working for
firefox. The same issue remains whereby the firefox browsers just keep
loading and doesn't redirect it to the actual site

May 9 '07 #4
On May 9, 9:27 am, iamaporkaho...@gmail.com wrote:
On May 8, 1:45 pm, ASM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
iamaporkaho...@gmail.com a écrit :
The main page of the site has this script which determines the
language settings of the OS. This works fine for IE but not for
firefox. Is there any other codes which i have to insert to make sure
Firefox would be able to load it?
In JavaScript the normal attributes for navigator are :
alert( ' appCodeName : ' +navigator.appCodeName+
'\n appName : ' +navigator.appName+
'\n appVersion : ' +navigator.appVersion+
'\n cookieEnabled : ' +navigator.cookieEnabled
'\n javaEnabled() : ' +navigator.javaEnabled()+
'\n language : ' +navigator.language+
'\n IE userLanguage : '+navigator.userLanguage+
'\n platform : ' +navigator.platform+
'\n userAgent : ' +navigator.userAgent;
<script type="text/javascript">
function detectlang()
{
var lang=navigator.userLanguage
var lang = navigator.language || navigator.userLanguage;
var langs=navigator.systemLanguage
doesn't exists (except IE ?)
var langb=navigator.browserLanguage
doesn't exists (except IE ?)
if
((langs=="ar-sa"||lang=="ar-sa"||langb=="ar-sa"))
or :
if(lang == 'ar-sa' || lang.substring(0,2) = 'ar')
{window.location.reload("http://www.flynas.com/ara/index.html")}
else
{window.location.reload("http://www.flynas.com/eng/index.html")}
}
</script>
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé

I did as suggested and remove navigator.browserLanguage &
navigator.systemLanguage from the script. It is still not working for
firefox. The same issue remains whereby the firefox browsers just keep
loading and doesn't redirect it to the actual site
there was a little extra code given to you which you have not used.
just try calling the following code lang.htm and run it in firefox,
there are sometimes 2 places where language preference will appear,
but mostly it is 3 places.

<script type="text/javascript">
alert( 'appCodeName : ' +navigator.appCodeName+
'\n appName : ' +navigator.appName+
'\n appVersion : ' +navigator.appVersion+
'\n cookieEnabled : ' +navigator.cookieEnabled+
'\n javaEnabled() : ' +navigator.javaEnabled()+
'\n language : ' +navigator.language+
'\n IE userLanguage : '+navigator.userLanguage+
'\n platform : ' +navigator.platform+
'\n userAgent : ' +navigator.userAgent
);
//also did you see
var lang = navigator.language || navigator.userLanguage;
alert(lang);
</script>
that should be enough for you.

BTW stick to using recognised country/language codes, so once you have
found one, dont then redirect to
ara or eng
but to
ar or en

or if you have dialects use en-GB or en-US etc... it will make your
life easier to follow standards, see what trouble IE caused you by
having its own windows specific way of doing things.

May 9 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
1912
by: Howard Kaikow | last post by:
Yesterday, I decided to try Firefox. I've encountered a behavior that is either a bug in Firefox or a bug in my Javascript code. I'll try to explain the problem, hoping that this newsgroup can...
2
9776
by: Chuck Martin | last post by:
I am having a most frustrating problem that references, web searches, and other resources are no help so far in solving. Basically, I'm trying to design a pop-up window to be called with a funciton...
3
2100
by: Jim Davis | last post by:
The scenario: 1) Generate a popup window via script. 2) Populate it (again via script) with content that features local (hash) links. In IE 6.x this works - the links work as they should,...
6
14431
by: Mark Olbert | last post by:
The doPostBack javascript functioning is not submitting the page when called by linkbuttons (or an autopostback checkbox, for that matter). I'm aware of a problem with Netscape browsers and the...
4
2309
by: lmarceglia | last post by:
Hi, I have this website that doesn't work in Firefox 1.5: www.pianetaluca.com The HTML source is: <TITLE>PianetaLuca</TITLE> </HEAD>
4
7442
by: evgenyg | last post by:
Hello ! We have the following situation - when Ajax request is sent what's being returned by the server is usually an XML (which is used for DOM updates) but sometimes it's HTML which is a whole...
4
4254
by: djlender | last post by:
Hi All! I'm hoping someone can help me with this situation. I am a developer working on a project that has a video voting page. The situation is this: The parent page has an iFrame ( named...
1
3519
by: SunshineInTheRain | last post by:
My project has 3 files, File1 has included master page. file1 consists of iframe1 that load file2. File2 consists of iframe2 that load file3. Javascript used on each file to resize the iframe...
0
7126
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
7005
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7168
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
7210
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...
1
6891
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5465
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,...
1
4916
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...
0
3087
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1424
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.