« Return to Thread: Is it possible for jQuery define version of browser, for example IE 7.0?

Re: Is it possible for jQuery define version of browser, for example IE 7.0?

by Isaak Malik-3 :: Rate this Message:

Reply to Author | View in Thread

Checking the version is more reliable by using object checking than the useragent string checking, or you can use both to increase the reliabilty.

IE 7:

if ( document.all && !window.opera && window.XMLHttpRequest && $.browser.msie ) var isIE7 = true;

or in HTML which is much better:

<!––[if IE 7]>
<script type="text/javascript">var isIE7 = true;</script>
<![endif]––>

IE6:

if ( document.all && !window.opera && !window.XMLHttpRequest && $.browser.msie ) var isIE6 = true;

or

<!––[if IE 6]>
<script type="text/javascript">var isIE6 = true;</script>
<![endif]––>

It is ok to leave out the "$.browser.msie".

I hope this willbe of any use.

On 6/16/08, RobG <rgqld@...> wrote:

On Jun 16, 4:38 pm, mtest <projects.supp...@...> wrote:
> I know that jQuery can define browser:
> $.browser.msie
> $.browser.safari
> $.browser.opera
> $.browser.mozilla
> but can I define version???
> IE 7.0 - ?
> IE 6.0 - ?
> IE 5.0 - ?


Browser detection is almost always based on the user agent string.  It
is known that UAs do not honestly report the vendor, version or
platform so any strategy based on that is flawed.  There are thousands
(literally) of UA strings, yet they are not guaranteed to be unique
for any particular browser or version.

Do a search for user agent string databases, there are quite a few of
them.



--
Rob



--
Isaak Malik
Web Developer

 « Return to Thread: Is it possible for jQuery define version of browser, for example IE 7.0?