现在的位置: 首页 > 综合 > 正文

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

2013年11月10日 ⁄ 综合 ⁄ 共 1301字 ⁄ 字号 评论关闭

 

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,

抱歉!评论已关闭.