您的位置:首页 > 其它

初始化是检测浏览器的类型

2010-06-02 15:05 302 查看
Re:
Is it possible to detect browser information directly from FLEX????


Hi Amit,

The replies from Gnomann are
correct.

Following the logic that Gnomann cited in his second post
(suggesting using ExternalInterface to execute browser JavaScript), following
are some examples.

These examples also demonstrate how JavaScript
methods can be written in-line directly in the ExternalInterface.call()
execution:

var appName:String = ExternalInterface.call(
"function
getAppName(){ return navigator.appName; }" )
;

var userAgent:String =
ExternalInterface.call(
"function getUserAgent() { return
navigator.userAgent; }" )
;

var appVersion:String =
ExternalInterface.call(
"function getAppVersion(){ return
navigator.appVersion; }" )
;

I have posted a different,
runnable example here:

http://flexflashvideo.com/codesamples/flex/flex3/browserinfo/

You can right-click on the swf at the link above for " View
Source
"

btw ... an advantage of writing the JavaScript methods
in-line in the ActionScript ExternalInterface.call() executions is that all of
the code can be encapsulated in the Flex logic. That is you do not have to write
the JavaScript separately in the HTML wrapper. You can if you want, of course.
Certainly no harm in that ;-) Since your original question was how to detect the
browser information "directly from FLEX", I suspect you might like being able to
write the JavaScript methods in-line ;-)

Please post back regarding
whether the above answers your question, and if you find it helpful :-)

Best regards,
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: