初始化是检测浏览器的类型
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,
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,
相关文章推荐
- PPK提供的浏览器类型及版本检测方法
- 检测浏览器版本类型及版本号
- 检测客户端显示器分辨率、浏览器类型和客户端IP
- 各种浏览器的userAgent及如何使用JS来检测游览器类型,或android是什么版本号
- 如何检测当前浏览器的类型及版本
- javascript 检测浏览器类型和版本的代码
- C#检测浏览器类型 Detect Browser
- 精彩代码回放:jQuery实现的浏览器类型和版本检测
- 检测客户端显示器分辨率、浏览器类型和客户端IP
- 检测浏览器类型
- Js_检测浏览器类型
- 检测客户端显示器分辨率、浏览器类型和客户端IP
- asp 浏览器类型检测
- JavaScript学习笔记之检测客户端类型是(引擎、浏览器、平台、操作系统、移动设备)
- 如何:在 ASP.NET(c#) 网页中检测浏览器类型
- 检测浏览器类型及版本
- 检测客户端显示器分辨率、浏览器类型和客户端IP
- 检测客户端显示器分辨率、浏览器类型和客户端IP
- 检测浏览器类型及版本