4ae9b8 / browserhacks

An extensive list of CSS/JS browserhacks from all over the interwebs.
http://browserhacks.com/
1.27k stars 149 forks source link

JavaScript hack "isSafari" not working in Safari 10 #172

Open cdumez opened 8 years ago

cdumez commented 8 years ago

It seems the following is currently used to detect Safari: /constructor/i.test(window.HTMLElement)

However, this will stop working in the next Safari release which you can test at: https://developer.apple.com/safari/download/

jeffclayton commented 8 years ago

Can you list which versions of safari are the last ones that it does detect? Knowing that makes it a more specific hack. Thanks in advance.

cdumez commented 8 years ago

It should work until Safari 9.x. However, it will stop working in the next major Safari release (presumably 10.0).

jeffclayton commented 8 years ago

Most likely, sometimes they change things before final build, but if they removed it they probably won't put it back. It is a good one to watch - finding ways to separate safari versions can be a pain.

jimmywarting commented 7 years ago

How about using window.safari?

jeffclayton commented 7 years ago

Do you know if all versions of Safari support it? Or if not all versions, which versions?

cdumez commented 7 years ago

By the way, Safari 10 was released and as expected, "/constructor/i.test(window.HTMLElement)" no longer detects it.

I have tried "window.safari" in Safari 10 and it is undefined (I don't know if this was ever a thing).

jeffclayton commented 7 years ago

Thank you for the info, in the meantime I worked out one for Safari 10 that is css only here:

_::-webkit-:host:not(:root:root), .selector { color:#0000FF; }
jimmywarting commented 5 years ago

I have tried "window.safari" in Safari 10 and it is undefined (I don't know if this was ever a thing).

window.safari is a "thing"

It contains things such as pushNotification - and that's the only thing i find in that object...

caniuse states push was available from 9.1 so i assume that window.safari came with 9.1?

FYI, I have used safari's push api, and it sucks really much, hate that they can't follow the standard specification 😞 Hope one day they deprecate that horrible api and follow the spec

i'm using /constructor/i.test(window.HTMLElement) || window.safari to detect any safari version. constructor ended with safari 10 and window.safari started with 9.1 (so quite a nice overlap)

jeffclayton commented 5 years ago

hack is most likely available up to 9.1 then, this is good info for browser targeting reasons.

On Mon, May 27, 2019 at 2:52 PM Jimmy Wärting notifications@github.com wrote:

I have tried "window.safari" in Safari 10 and it is undefined (I don't know if this was ever a thing).

window.safari is a "thing"

It contains things such as pushNotification https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/NotificationProgrammingGuideForWebsites/PushNotifications/PushNotifications.html

  • and that's the only thing i find in that object...

caniuse states push was available from 9.1 so i assume that window.safari came with 9.1?

FYI, I have used safari's push api, and it sucks really much, hate that they can't follow the standard specification 😞 Hope one day they deprecate that horrible api and follow the spec

i'm using /constructor/i.test(window.HTMLElement) || window.safari to detect any safari version.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/4ae9b8/browserhacks/issues/172?email_source=notifications&email_token=ABKXOT5GUUHDDY3SFYEJHYTPXQUWRA5CNFSM4B7XI452YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWKLLOA#issuecomment-496285112, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKXOT2PZDBUDA5PTA7MAFLPXQUWRANCNFSM4B7XI45Q .

jimmywarting commented 4 years ago

window.WebKitPoint maybe?

https://developer.apple.com/documentation/webkitjs/webkitpoint

jeffclayton commented 4 years ago

We would have to test it after finding a true/false command for it -- versions of edge and Chrome (search google for WebKitPoint to see what I mean) have used it as well as Safari. Not saying no, just saying we will need to know exact browser specs. Once having that it is possible to add filters for additional things. Chrome and Safari started out using the same webkit engine originally, so adjustments were needed based usually on bugs that did not affect one but affected the other.

On Fri, Nov 22, 2019 at 7:42 PM Jimmy Wärting notifications@github.com wrote:

window.WebKitPoint maybe?

https://developer.apple.com/documentation/webkitjs/webkitpoint

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/4ae9b8/browserhacks/issues/172?email_source=notifications&email_token=ABKXOTZEE2Z6EOZYQKPSPTDQVB4BBA5CNFSM4B7XI452YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEE7IJ7Y#issuecomment-557745407, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKXOT62SAA3HS77CNCBQADQVB4BBANCNFSM4B7XI45Q .