Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cdumez opened this issue Apr 1, 2016 · 11 comments
Open

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

cdumez opened this issue Apr 1, 2016 · 11 comments
Labels

Comments

@cdumez
Copy link

cdumez commented Apr 1, 2016

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
Copy link
Collaborator

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
Copy link
Author

cdumez commented Apr 1, 2016

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

@jeffclayton
Copy link
Collaborator

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
Copy link

How about using window.safari?

@jeffclayton
Copy link
Collaborator

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

@cdumez
Copy link
Author

cdumez commented Sep 24, 2016

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).

@cdumez cdumez changed the title JavaScript hack "isSafari" not working on Safari Technology Preview JavaScript hack "isSafari" not working in Safari 10 Sep 24, 2016
@jeffclayton
Copy link
Collaborator

jeffclayton commented Sep 24, 2016

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
Copy link

jimmywarting commented May 27, 2019

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
Copy link
Collaborator

jeffclayton commented May 28, 2019 via email

@jimmywarting
Copy link

window.WebKitPoint maybe?

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

@jeffclayton
Copy link
Collaborator

jeffclayton commented Nov 23, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants