I need to define IE6 to get around the lack of position: fixed. I used a simple regex:
var isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
This works almost all the time, except for a user whose browser claims to be both IE6 and IE7:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 3.0.04506.30)
Nice.
I would like to use jquery.support , but it does not seem to support the query about whether the position is available: fixed, So I returned to detecting IE6.
There are various suggested solutions, such as finding maxHeight . But they seem rather random and scare me - if there are exceptions for the regular expression above, how can I be sure that there are no exceptions for maxHeight?
I am thinking about using conditional comments - this way, at least, it will be IE itself, claiming to be IE6, not hacking. Sort of:
An alternative is f unction, which directly checks if the position is: fixed , but it seems a little heavy.
Any reason my conditional comment approach is not working? Are there any more efficient approaches?
source
share