Identify the browser

How can I identify the browser I am using?
In Flash I was used to call a function with ExternalInterface, but the same function cause an error now

var browserAgent : String ="function getBrowser(){return navigator.userAgent;}");

SyntaxError: expected expression, got '.'

Is there an alternative way or am I really missing a Syntax error?

You can try using methods from the Sys class (it comes comes standard with Haxe):

The haxe.js package is probably a better option:

You can try this

public inline static function isFirefox():Bool
    return Browser.navigator.userAgent.indexOf("Firefox") != -1;

@dimumurray, @T1mL3arn

Browser.navigator.userAgent.indexOf("Firefox") != -1;

works, thank you guys!
I will give Sys a try, but for now I am ok with js.Browser.

So I don’t need ExternalInterface anymore… I wonder if I can avoid it in other situations too…