Actionscript 3、flex:如何找出您当前使用的浏览器?
我需要通过 AS3 内部的 flex mxml 应用程序检测我所在的浏览器 - FF、Chrome、IE 等,只有名称和版本。这样的事该怎么办呢?
I need to detect via AS3 inside flex mxml appication which is browser I am in - FF, Chrome, IE etc, only name and version. How to do such thing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,您将使用 javascript,但实际上并不需要将 javascript 放入页面中。
下面是一个从 Flex 应用程序获取信息的快速脚本示例,无需向包含的 html 页面添加任何内容:
这会将信息跟踪到控制台,因此,例如,当我运行它时,我得到:
如果您有任何问题,请告诉我!
Yes, you're going to use javascript, but you dont actually need to put javascript in the page.
Here's a quick script example of getting that information from your flex app without adding anything to the containing html page:
This traces the info out to the console, so for example when I run it I get :
Let me know if you have any issues!
如果您使用一些客户端 JavaScript 和 Flash 库中的ExternalInterface 类,这并不困难。
这是有关执行此操作的简短教程: http://codingrecipes.com /calling-a-javascript-function-from-actionscript-3-flash
您的 JS 需要运行浏览器客户端检查。
It's not tricky if you use some client side JavaScript and the ExternalInterface class in the Flash library.
Here's a brief tutorial on doing that: http://codingrecipes.com/calling-a-javascript-function-from-actionscript-3-flash
Your JS would need to run a browser client check.
根据我的研究,
navigator.appName
将为 IE11、Firefox、Chrome 和 Safari 等浏览器返回字符串Netscape
。检查 此。如果您想检测浏览器名称,请尝试以下操作:
参考:检查访客操作系统和浏览器使用as3的浏览器
As per my research
navigator.appName
will return stringNetscape
for browsers like: IE11, Firefox, Chrome and Safari. check this.If you want to detect browser name try this:
reference : check visitor OS & Browser using as3