Skip to main content
July 25, 2007
Question

flash method to detect the user browser version.

  • July 25, 2007
  • 11 replies
  • 1392 views
Hello, I found this property in Flash: System.capabilities.
You can retreive some information about the user, but i did not find how i can detect
what kind of browser they use to view the flash.

example:
trace(System.capabilities.os); // output is the current Operating system.. in my case "Windows XP"

Does anyone know how to detect the browser and the version of it?

Regards,

Michea.
This topic has been closed for replies.

11 replies

kglad
Community Expert
Community Expert
August 14, 2007
you're welcome.
kglad
Community Expert
Community Expert
August 14, 2007
great.
August 14, 2007
Yes, it is...
BUT
it returns a VERY long string containing the full information about the browser and also the machine:
"mozilla/5.0 (macintosh; u; ppc mac os x; en) applewebkit/419.3 (khtml, like gecko) safari/419.3"

How can I treat this string to retain only the very last part of it ("safari/419.3") and display it as "Safari, 419.3"
I know this has something to do with indexOf but I don't know (and understand) how to use it...

Any idea?
kglad
Community Expert
Community Expert
August 14, 2007
:

August 13, 2007
OH YES !!!
I fully agree with this.
kglad
Community Expert
Community Expert
August 12, 2007
no, i don't have a mac and i don't have safari.

and no, getting null would mean something is being returned while getting undefined could mean something is being returned or not.

anyway, it's easy to test the latter: call a non-existent function a see what you get.
August 13, 2007
quote:

Originally posted by: kglad
no, i don't have a mac and i don't have safari.
call a non-existent function a see what you get.


Too bad about Mac and Safari...
I did call for a non-existent function and got the same result: undefined

I thought the problem was Safari related. No doubt?


kglad
Community Expert
Community Expert
August 13, 2007
if you're using the same flash player version in safari as you are in your other browsers, then the problem is because of safari.

that doesn't necessarily mean the problem is in surmountable but it does mean it's not a flash/actionscript issue: it's probably a javascript and safari issue.
August 11, 2007
My Flash Tracer module doesn't work for the moment with Firefox...
Don't know why...
But my .swf when using Firefox, now clearly displays the Browser and its Version !!!
I think my problem is Safari related.

I'm going to test with Netscape 7 for Mac...
kglad
Community Expert
Community Expert
August 11, 2007
it should work with all the browser's listed in the javascript.

the problem with flash tracer is a different issue. i have no trouble with flash tracer in firefox.
August 11, 2007
I fully agree with you : it SHOULD but... it doesn't!
Safari is the only browser with which it doesn't work...
I tested it with IE, Netscape, Firefox and Opera.
Do you run Safari on Mac OS X? so you could be able to test it...
I put the code to get the values in the very first frame of the movie and it is on an "open" layer i.e. it is available from any frame of the movie.

Any idea to "force" the script to work for Safari?

For the Flash Tracer, I think the problem is Mac related...

Anyway, thanks for your time!
August 11, 2007
We both have had the same idea at the same time !
I'm working on it.

But, a little remark :
If the communication between the .swf and the HTML page did not occur at all, the result should be "null".
If I get "undefined", I think it means that the communication exists but it gives no result...
What do you think ?
kglad
Community Expert
Community Expert
August 11, 2007
and are you using flash tracer to see the trace statements?
August 11, 2007
You can inspect the source code of my HTML page at :
< http://www.notre-annuaire.com/test/start.html>
kglad
Community Expert
Community Expert
August 11, 2007
you're not testing in the test environment, are you?
August 11, 2007
No.
I'm testing in real world.
kglad
Community Expert
Community Expert
July 25, 2007
use javascript in the html file and the externalinterface class in flash to communicate with the javascript.
July 30, 2007
Does anybody has an example of this?
kglad
Community Expert
Community Expert
July 30, 2007
: