WEBDOOD.COM

Tag: browser detection

Detect Safari 3

by webdood on Aug.26, 2010, under Javascript, Safari-Specific, Software Development

Today I needed a quick way to detect Safari3 for some specific markup tricks, so I wrote this function.
Thought it might be helpful to someone else.

<script type="text/javascript">
  var isSafari3 = (function() {
    var retval = false;
    if (navigator.vendor && navigator.vendor.indexOf('Apple') > -1) {
      var index=navigator.appVersion.indexOf('Version');
      if (index > -1) {
        retval = (parseInt(navigator.appVersion.substring(index+8))==3);
      }
    }
  return retval;
  })();
alert(isSafari3);
</script>

Shannon Norrell

Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...

  • A List Apart
  • Dive into HTML5
  • Javascript: The Good Parts
  • QuirksMode.org