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

Catch "Safari" and "Safari Mobile" in a single check #685

Open
maphe opened this issue Oct 18, 2023 · 3 comments
Open

Catch "Safari" and "Safari Mobile" in a single check #685

maphe opened this issue Oct 18, 2023 · 3 comments

Comments

@maphe
Copy link

maphe commented Oct 18, 2023

Is your feature request related to a problem? Please describe.
Today is("Safari") is does not catch variants like Mobile Safari. That's one example I came across but now I'm wondering if I'm missing other cases.

Describe the solution you'd like
It would be nice to have a helper function similar to is() but doing string matching instead of equality (eg. match()). I imagine that'd also help for Windows and Windows Phone and some other cases.

Describe alternatives you've considered
Right now I'm doing is("Safari") || is("Mobile Safari") but that feels a little precarious.

Thanks

@maphe maphe changed the title Catch "Safari" and "Safari" mobile in a single check Catch "Safari" and "Safari Mobile" in a single check Oct 18, 2023
@faisalman
Copy link
Owner

Hi! Thanks for the suggestion, as a general rule, I'll consider to add a feature if there are enough users who need it as well.

In the mean time we can also use includes():

browser.name.includes("Safari")

@maphe
Copy link
Author

maphe commented Oct 19, 2023

Cool thanks, that's what I ended up doing but it is case-sensitive, which is() is a nice trick for.

Thanks for considering, and thank for the work.

@aradalvand
Copy link

Somewhat related question: Is Safari detected as Mobile Safari when device.type is tablet (i.e. in iPad)?

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

No branches or pull requests

3 participants