0

Can I someone recognize version of Safari browser in js or jQuery? I am not looking for webkit version but for version of Safari (for example: 5.1.7).

I need to hide some element for Safari which is less than v7 :(

Lucfia
  • 621
  • 1
  • 7
  • 14
  • safari 5.1 doesn't implement `FileReader` ... but your question is broad ... you say "for example 5.1.7" then say "less than 7" ... use feature detection and don't concentrate on pinning down a version – Jaromanda X Sep 07 '16 at 14:26

2 Answers2

1

This hack worked out by combining multiple other hacks is for 6.1+:

/* Safari 6.1+ (9.0 is the latest version of Safari at this time) */

@media screen and (min-color-index:0) 
and(-webkit-min-device-pixel-ratio:0) { @media
{
    .safari_only { 

        color:#0000FF; 
        background-color:#CCCCCC; 

    }
}}

Below are hacks that separate 6.1-7.0, and 7.1+ These also required a combination of multiple hacks in order to get the right result:

/* Safari 6.1-7.0 */

@media screen and (-webkit-min-device-pixel-ratio:0) 
and (min-color-index:0)
{  
   .safari_only {(;

      color:#0000FF; 
      background-color:#CCCCCC; 

    );}
}

Here is one for Safari 8 and newer:

/* Safari 7.1+ (9.0 is the latest version of Safari at this time) */

_::-webkit-full-page-media, _:future, :root .safari_only {

  color:#0000FF; 
  background-color:#CCCCCC; 

}

refer this link: https://jeffclayton.wordpress.com/2015/04/28/css-hacks-for-safari-6-1-7-and-8-not-chrome/

Jayababu
  • 1,641
  • 1
  • 14
  • 30
1

Use

if(speechSynthesis){
  //code to be run in Safari 7+
}else{
  //code not to be run in said versions
}

This should work, as speechSynthesis was added in version 7.

Source: http://CanIUse.com/#compare=safari+6.1,safari+7

MegaTom
  • 312
  • 1
  • 6
  • 14