如何检测Firefox的用户代理? [英] How to detect Firefox user agent?
问题描述
我的工作在哪里,我需要做的遗产code,它主要设计用于Internet Explorer,是火狐工作的应用程序。
我击中的问题是嵌套表结构中不扩大到表格单元格的全高度内部框架。由于Web应用程序的大小已决定建立一个JavaScript垫片来解决,而不是把加价的变化这一问题。这个垫片将只包括如果浏览器是Firefox作为问题不中我已经测试过其他的浏览器存在的页面上。
所以我的问题是:
使用传统的ASP VBScript函数如何才能辨别Firefox浏览器,这应包括任何边缘情况?
到目前为止,我有这将检查字符串值火狐用户代理以下。是否有任何情况下,这是行不通的?
函数IsFirefox() 昏暗的userAgent:=的userAgent Request.ServerVariables(HTTP_USER_AGENT)
暗淡locationOfFirefox:locationOfFirefox = INSTR(1,的userAgent,火狐,1) IsFirefox =(locationOfFirefox大于0)最终功能
据Mozilla基金会的文件,火狐必须由用户代理被识别时,它的包含字符串的火狐/ XYZ的并没有包含字符串的组件Seamonkey / XYZ的。更多信息:
的https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent
I am working on an application where I am required to make legacy code, which has been designed primarily for Internet Explorer, work with Firefox.
The problem I have hit is iframes nested within a table structure do not expand to the full height of the table cell. Due to the size of the web application the decision has been made to create a JavaScript shim to address this issue instead of making mark-up changes. This shim will only be included on the page if the browser is Firefox as the problem does not exist within other browsers I have tested.
So my question is:
Using a classic ASP VBScript function how can I identify Firefox browsers, this should include any edge cases?
So far I have the following which checks the user agent for the string value "Firefox". Are there any cases where this would not work?
function IsFirefox()
dim userAgent : userAgent = Request.ServerVariables("HTTP_USER_AGENT")
dim locationOfFirefox : locationOfFirefox = InStr(1, userAgent, "Firefox", 1)
IsFirefox = (locationOfFirefox > 0)
end function
According to a document from the Mozilla Foundation, Firefox must be identified by the user agent when it contains the string "Firefox/xyz" and does not contain the string "Seamonkey/xyz". More information:
https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent
这篇关于如何检测Firefox的用户代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!