473,395 Members | 1,629 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,395 software developers and data experts.

A question on Firefox


Hello group,

I'm kinda skeptical about a code is being used in my js program. All it
does is checking what browser is being run and finds out if FLASH is
installed or not.

This code works just fine withe IE but as far as Firefox I'm not sure.
Using the firefox I can see flash pages easily but when this code says
firefox is not installed in my firefox!!!

Any suggestions?

Please know that I have another machine with firefox (without flash)
and the code reacts fine.

Thanks in advance,
Amit.

Jul 27 '06 #1
12 1744
amit said the following on 7/27/2006 5:35 PM:
Hello group,

I'm kinda skeptical about a code is being used in my js program. All it
does is checking what browser is being run and finds out if FLASH is
installed or not.
"checking what browser is being run"? Yes, you should be very skeptical
about it.
This code works just fine withe IE but as far as Firefox I'm not sure.
I bet it doesn't.
Using the firefox I can see flash pages easily but when this code says
firefox is not installed in my firefox!!!
"firefox is not installed in your firefox"? I wanna know how to do that
so that I can have my firefox installed in my firefox.
Any suggestions?
Ummm, perhaps posting your browser detection and Flash detection code?
Please know that I have another machine with firefox (without flash)
and the code reacts fine.
I bet it doesn't, you just think it does. But, I wouldn't know because I
can't see the code.....

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 27 '06 #2

Randy Webb wrote:
amit said the following on 7/27/2006 5:35 PM:
Hello group,

I'm kinda skeptical about a code is being used in my js program. All it
does is checking what browser is being run and finds out if FLASH is
installed or not.

"checking what browser is being run"? Yes, you should be very skeptical
about it.
This code works just fine withe IE but as far as Firefox I'm not sure.

I bet it doesn't.
Using the firefox I can see flash pages easily but when this code says
firefox is not installed in my firefox!!!

"firefox is not installed in your firefox"? I wanna know how to do that
so that I can have my firefox installed in my firefox.
Any suggestions?

Ummm, perhaps posting your browser detection and Flash detection code?
Please know that I have another machine with firefox (without flash)
and the code reacts fine.

I bet it doesn't, you just think it does. But, I wouldn't know because I
can't see the code.....

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

Hi Randy,

Thanks! here is the code:

IEFlashStat = ((navigator.appName.indexOf("Microsoft") != -1) &&
(navigator.appVersion.indexOf("Windows") !=
-1))&&
(parseFloat(navigator.appVersion) >= 4 ) ? true
: false;
if (IEFlashStat )
{
alert("IE and flash OK");
//Ok, the browser detected as IE4 or 4+; ready for
Flash events
_bFlash = true;
}
else
{
//The browser is not IE so check if we are dealing with
NN or FF
NNFlashStat = ((navigator.appName == "Netscapt") &&
(navigator.userAgent.indexOf("Mozilla") != -1))
? ture : false;

if (NNFlashStat)
{
alert("yep, Flash in FF or NN");
_bFlash = true;
}
else
{
_bFlash = false;
alert("no flash in your FF or NN");
}
}

Please let me know what you think of it.

Thanks for being helpful.
one more thing when I use macros or predefined variable in Javascript
it has difficulty why is that?

let's say at the top of the code I have:

var ms = "Microsoft";
navigator.appName.indexOf(ms)

will not work. why?
Amit.

Jul 27 '06 #3
Well, just browsing quickly I found this already...

NNFlashStat = ((navigator.appName == "Netscapt") &&

Since when has there been a browser called "Netscapt"? You may wish to
prrof read more...

"amit" <am********@gmail.comwrote in message
news:11**********************@s13g2000cwa.googlegr oups.com...
>
Randy Webb wrote:
>amit said the following on 7/27/2006 5:35 PM:
Hello group,

I'm kinda skeptical about a code is being used in my js program. All it
does is checking what browser is being run and finds out if FLASH is
installed or not.

"checking what browser is being run"? Yes, you should be very skeptical
about it.
This code works just fine withe IE but as far as Firefox I'm not sure.

I bet it doesn't.
Using the firefox I can see flash pages easily but when this code says
firefox is not installed in my firefox!!!

"firefox is not installed in your firefox"? I wanna know how to do that
so that I can have my firefox installed in my firefox.
Any suggestions?

Ummm, perhaps posting your browser detection and Flash detection code?
Please know that I have another machine with firefox (without flash)
and the code reacts fine.

I bet it doesn't, you just think it does. But, I wouldn't know because I
can't see the code.....

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/


Hi Randy,

Thanks! here is the code:

IEFlashStat = ((navigator.appName.indexOf("Microsoft") != -1) &&
(navigator.appVersion.indexOf("Windows") !=
-1))&&
(parseFloat(navigator.appVersion) >= 4 ) ? true
: false;
if (IEFlashStat )
{
alert("IE and flash OK");
//Ok, the browser detected as IE4 or 4+; ready for
Flash events
_bFlash = true;
}
else
{
//The browser is not IE so check if we are dealing with
NN or FF
NNFlashStat = ((navigator.appName == "Netscapt") &&
(navigator.userAgent.indexOf("Mozilla") != -1))
? ture : false;

if (NNFlashStat)
{
alert("yep, Flash in FF or NN");
_bFlash = true;
}
else
{
_bFlash = false;
alert("no flash in your FF or NN");
}
}

Please let me know what you think of it.

Thanks for being helpful.
one more thing when I use macros or predefined variable in Javascript
it has difficulty why is that?

let's say at the top of the code I have:

var ms = "Microsoft";
navigator.appName.indexOf(ms)

will not work. why?
Amit.

Jul 27 '06 #4
Hmm - prrof? PROOF... Perhaps I should too!

"PSI_Orion" <or***@psiss.comwrote in message
news:_v****************@newsfe3-win.ntli.net...
Well, just browsing quickly I found this already...

NNFlashStat = ((navigator.appName == "Netscapt") &&

Since when has there been a browser called "Netscapt"? You may wish to
prrof read more...

"amit" <am********@gmail.comwrote in message
news:11**********************@s13g2000cwa.googlegr oups.com...
>>
Randy Webb wrote:
>>amit said the following on 7/27/2006 5:35 PM:
Hello group,

I'm kinda skeptical about a code is being used in my js program. All
it
does is checking what browser is being run and finds out if FLASH is
installed or not.

"checking what browser is being run"? Yes, you should be very skeptical
about it.

This code works just fine withe IE but as far as Firefox I'm not sure.

I bet it doesn't.

Using the firefox I can see flash pages easily but when this code says
firefox is not installed in my firefox!!!

"firefox is not installed in your firefox"? I wanna know how to do that
so that I can have my firefox installed in my firefox.

Any suggestions?

Ummm, perhaps posting your browser detection and Flash detection code?

Please know that I have another machine with firefox (without flash)
and the code reacts fine.

I bet it doesn't, you just think it does. But, I wouldn't know because I
can't see the code.....

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/


Hi Randy,

Thanks! here is the code:

IEFlashStat = ((navigator.appName.indexOf("Microsoft") != -1) &&
(navigator.appVersion.indexOf("Windows") !=
-1))&&
(parseFloat(navigator.appVersion) >= 4 ) ? true
: false;
if (IEFlashStat )
{
alert("IE and flash OK");
//Ok, the browser detected as IE4 or 4+; ready for
Flash events
_bFlash = true;
}
else
{
//The browser is not IE so check if we are dealing with
NN or FF
NNFlashStat = ((navigator.appName == "Netscapt") &&
(navigator.userAgent.indexOf("Mozilla") != -1))
? ture : false;

if (NNFlashStat)
{
alert("yep, Flash in FF or NN");
_bFlash = true;
}
else
{
_bFlash = false;
alert("no flash in your FF or NN");
}
}

Please let me know what you think of it.

Thanks for being helpful.
one more thing when I use macros or predefined variable in Javascript
it has difficulty why is that?

let's say at the top of the code I have:

var ms = "Microsoft";
navigator.appName.indexOf(ms)

will not work. why?
Amit.


Jul 27 '06 #5

PSI_Orion wrote:
Hmm - prrof? PROOF... Perhaps I should too!

"PSI_Orion" <or***@psiss.comwrote in message
news:_v****************@newsfe3-win.ntli.net...
Well, just browsing quickly I found this already...

NNFlashStat = ((navigator.appName == "Netscapt") &&

Since when has there been a browser called "Netscapt"? You may wish to
prrof read more...

"amit" <am********@gmail.comwrote in message
news:11**********************@s13g2000cwa.googlegr oups.com...
>
Randy Webb wrote:
amit said the following on 7/27/2006 5:35 PM:
Hello group,

I'm kinda skeptical about a code is being used in my js program. All
it
does is checking what browser is being run and finds out if FLASH is
installed or not.

"checking what browser is being run"? Yes, you should be very skeptical
about it.

This code works just fine withe IE but as far as Firefox I'm not sure.

I bet it doesn't.

Using the firefox I can see flash pages easily but when this code says
firefox is not installed in my firefox!!!

"firefox is not installed in your firefox"? I wanna know how to do that
so that I can have my firefox installed in my firefox.

Any suggestions?

Ummm, perhaps posting your browser detection and Flash detection code?

Please know that I have another machine with firefox (without flash)
and the code reacts fine.

I bet it doesn't, you just think it does. But, I wouldn't know because I
can't see the code.....

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/
Hi Randy,

Thanks! here is the code:

IEFlashStat = ((navigator.appName.indexOf("Microsoft") != -1) &&
(navigator.appVersion.indexOf("Windows") !=
-1))&&
(parseFloat(navigator.appVersion) >= 4 ) ? true
: false;
if (IEFlashStat )
{
alert("IE and flash OK");
//Ok, the browser detected as IE4 or 4+; ready for
Flash events
_bFlash = true;
}
else
{
//The browser is not IE so check if we are dealing with
NN or FF
NNFlashStat = ((navigator.appName == "Netscapt") &&
(navigator.userAgent.indexOf("Mozilla") != -1))
? ture : false;

if (NNFlashStat)
{
alert("yep, Flash in FF or NN");
_bFlash = true;
}
else
{
_bFlash = false;
alert("no flash in your FF or NN");
}
}

Please let me know what you think of it.

Thanks for being helpful.
one more thing when I use macros or predefined variable in Javascript
it has difficulty why is that?

let's say at the top of the code I have:

var ms = "Microsoft";
navigator.appName.indexOf(ms)

will not work. why?
Amit.
oh! thanks for your review and help!

Jul 27 '06 #6
amit wrote:
Randy Webb wrote:
amit said the following on 7/27/2006 5:35 PM:
Hello group,
>
I'm kinda skeptical about a code is being used in my js program. All it
does is checking what browser is being run and finds out if FLASH is
installed or not.
It does the first unreliably and doesn't do the second at all. Please
read about browser detection, it is utterly unreliable.
[...]
>
IEFlashStat = ((navigator.appName.indexOf("Microsoft") != -1) &&
(navigator.appVersion.indexOf("Windows") !=
-1))&&
(parseFloat(navigator.appVersion) >= 4 ) ? true
: false;
Your test is equivalent to:

IEFlashStat = (true)? true : false;
Consider:

IEFlashStat = navigator.appName.indexOf("Microsoft") != -1
&& navigator.appVersion.indexOf("Windows") != -1
&& parseFloat(navigator.appVersion) >= 4;

if (IEFlashStat )
{
alert("IE and flash OK");
//Ok, the browser detected as IE4 or 4+; ready for
Flash events
_bFlash = true;
If the tests above returned true, how does that prove that the browser
is IE? Or that Flash is installed? And why not set _bFlash in the
first place, why store the result in IEFlashStat then copy it to
_bFlash?

}
else
{
//The browser is not IE so check if we are dealing with
NN or FF
NNFlashStat = ((navigator.appName == "Netscapt") &&
(navigator.userAgent.indexOf("Mozilla") != -1))
? ture : false;
Supposing you fix the "Netscapt" typo, the value of NNFlashStat will be
"ture".

if (NNFlashStat)
Which neatly type-converts here to boolean true. Compensating errors -
clever! If you ditch the unnecessary test to see if true is true, you
remove the possiblity of making that typo altogether.

{
alert("yep, Flash in FF or NN");
_bFlash = true;
So how did that prove that Flash was installed? Even if it detected
Flash reliably (and it absolutely doesn't), how do you know the user
isn't blocking Flash content? e.g. using Firefox and Flashblock.

The bottom line is, your "detection" is useless. Assume that some of
your visitors can't see your Flash stuff and that you have no way of
knowing which ones they are.

[...]
one more thing when I use macros or predefined variable in Javascript
it has difficulty why is that?

let's say at the top of the code I have:

var ms = "Microsoft";
navigator.appName.indexOf(ms)

will not work. why?
What is your definition of 'work'?

You have initialised a global variable with a value of the string
"Microsoft". You then test to see whether that string exists within
the string returned by navigator.appName. You don't do anything with
the result, it vanishes into the ether - unused, unloved and
unlamented.

--
Rob

Jul 28 '06 #7
RobG said the following on 7/27/2006 9:01 PM:
amit wrote:
<snip>

> else
{
//The browser is not IE so check if we are dealing with
NN or FF
NNFlashStat = ((navigator.appName == "Netscapt") &&
(navigator.userAgent.indexOf("Mozilla") != -1))
? ture : false;

Supposing you fix the "Netscapt" typo, the value of NNFlashStat will be
"ture".
Actually, it would be undefined since ture is not quoted. Since there is
no variable named ture anywhere, it would result in it being undefined.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 28 '06 #8
Randy Webb a écrit :
"firefox is not installed in your firefox"? I wanna know how to do that
so that I can have my firefox installed in my firefox.
chrome://browser/content/browser.xul

--
laurent
Jul 28 '06 #9
amit <am********@gmail.comwrote:
I'm kinda skeptical about a code is being used in my js program. All it
does is checking what browser is being run and finds out if FLASH is
installed or not.
Generally, best practice code does not rely on browser detection.
There are innumerable browsers in existence and use, most of which you
have probably not thought of; for example, early versions of
Firefox/Firebird identify with fanciful names such as "Fireoyster".
More typically, you have failed to consider the significant number of
users who will be using Konqueror, Galeon, Opera or Lynx. Rather than

if( browser_is_IE )
...
else if( browser_is_Firefox )
...

, prefer

if( object.feature )
use_it();
else if( another_object.outdatedFeature )
use_it_instead();
else if( some.really.old.feature )
try_that();

This has the further advantage of not being caught short by the
non-zero number of users still using dead IE versions with primitive
script support; believe it or not, there are Netscape 4 and IE 4 users
out there.

--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome.
Jul 28 '06 #10
Christopher Benson-Manica said the following on 7/27/2006 10:23 PM:
amit <am********@gmail.comwrote:
>I'm kinda skeptical about a code is being used in my js program. All it
does is checking what browser is being run and finds out if FLASH is
installed or not.

Generally, best practice code does not rely on browser detection.
One small correction. "best practice code" *never* relies on browser
detection, *ever*.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 28 '06 #11
Laurent Vilday said the following on 7/27/2006 9:35 PM:
Randy Webb a écrit :
>"firefox is not installed in your firefox"? I wanna know how to do
that so that I can have my firefox installed in my firefox.

chrome://browser/content/browser.xul

Weal Ile be dammed if dat aint kewel.

Not sure what I would ever want to use that for but it's still neat.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 28 '06 #12

Randy Webb wrote:
Christopher Benson-Manica said the following on 7/27/2006 10:23 PM:
amit <am********@gmail.comwrote:
I'm kinda skeptical about a code is being used in my js program. All it
does is checking what browser is being run and finds out if FLASH is
installed or not.
Generally, best practice code does not rely on browser detection.

One small correction. "best practice code" *never* relies on browser
detection, *ever*.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

Thanks to you all,

I started Javascript 2 months ago that is why I keep posting my
questions on here and of course there are so many experts in this group
that come up with good solutions as you guys did here but in the case
it seems there is no way to detect Flash in a browser.

Right?

Also, here my concern was detecting only IE and FF since most of the
users use IE or FF these days but yes you are right there are so many
browsers up there that makes it hard to conver all those things.

Regarding macro or pre defined variables I must say since I'm coming
from a C programming background so I was expecting to use the same
habit here but it looks it is not going to work.

Once again thanks for your help and looking forward to hear more advice
from you guys.

Amit.

Jul 28 '06 #13

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

Similar topics

3
by: Jeremy Epstein | last post by:
I've got a 4-page form that lets users enter a whole lot of information, which is then submitted and emailed at the end. All the fields are stored as session data. The whole thing works fine: ...
6
by: Geoff | last post by:
When trying to focus a field in Firefox, I get the following error: Error: " nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame ::...
87
by: expertware | last post by:
Dear friends, My name is Pamela, I know little about CSS, but I would like to ask a question I have an image on a web page within a css layer: <DIV ID=MyLayer STYLE = "position:...
14
by: expertware | last post by:
Ok! to avoid confusion I will start a new argument. Thanks!! FIREFOX 1.0.7 AND IE6 viewed through DATATIME: a summary REPORT ===============================================================...
5
by: SPE - Stani's Python Editor | last post by:
Hi, During optimizing SPE for Ubuntu, I found something strange. I have Ubuntu 5.10 "The Breezy Badger" and unfortunately this code is not working: >>> import webbrowser >>>...
7
by: Coder | last post by:
Hi I have the following code in java script, it is not giving proper output in FIREFOX but running fine in IE... can anybody help me out to make this run in FIREFOX . <script...
6
by: scotty | last post by:
I have a script that loops through an existing table list and prepares each href element node to trigger a function when an image is clicked. The function that will be run passes a property value...
7
by: Carlos Mendonça | last post by:
Has anyone managed to get ClickOnce to work with Firefox? It seems to me that it still has the same issues VS 2K5 had. I appreciate any comments or tips.
3
by: SAL | last post by:
Hello, I did google this issue and found some stuff related to BrowserCaps section of either web.config or machine.config but it didn't work. It seems that most pages in my webapp are okay but a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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
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...

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.