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

iPadOS' Safari 13 is not being detected anymore #404

Closed
mkbctrl opened this issue Oct 17, 2019 · 11 comments
Closed

iPadOS' Safari 13 is not being detected anymore #404

mkbctrl opened this issue Oct 17, 2019 · 11 comments

Comments

@mkbctrl
Copy link

mkbctrl commented Oct 17, 2019

Description

Issue originally occured on the Safari 13.1, newest iPad ( not pro ).

How to reproduce

Example partial we are rendering for mobile and tablet like devices. Works perfectly on Firefox, Chrome, even Edge. Safari 12 is also performing fine.

<% unless browser.device.mobile? || browser.device.tablet? %>
    <%= render "welcome/default/partials/filters/dropdown_manufacturer" %>
<% end %>

You can go to http://vehiculum.de with browserstack in example and the that the filters in the main header of the homepage are behaving differently:

Safari 13:
Screenshot 2019-10-17 at 18 06 51

Safari 12 - desired behavior:
Screenshot 2019-10-17 at 18 07 26

Screenshot 2019-10-17 at 18 08 55

Software:

  • Rails version: 5.1.6.2
  • Browser gem version: 2.5.3

Report

Screenshot 2019-10-17 at 18 12 07

@fnando
Copy link
Owner

fnando commented Oct 17, 2019

Can you paste the actual report url instead of a screenshot? Thanks!

@mkbctrl
Copy link
Author

mkbctrl commented Oct 17, 2019

I have updated the gem to the 2.6.1 version. Still no luck. I have also tried silly if statement:

<% if browser.device.ipad? %>
      <h1>IPAD</h1>
    <% end %>

and suprisingly it does not work on safari 13 as well. Looking for other options...

@mkbctrl
Copy link
Author

mkbctrl commented Oct 18, 2019

@fnando do you have any quick ideas about a hacky solution to the problem? From what I have found so far, it will be difficult to parse any info that makes sense, cause it's missing from iPad Safari's user agent.
The user agent looks the same as the desktop user agent...

I was thinking about using JS with template tag, to render the contents conditionally based on touch support + screen size, will try to make it work today.

@jdittmar
Copy link

jdittmar commented Nov 6, 2019

any updates on this @fnando ?

@fnando
Copy link
Owner

fnando commented Nov 16, 2019

I finally got the time to handle this issue: the problem is that Safari's user agent doesn't add device identifiers anymore, which means one cannot further detect whether the device is an iPad or not.

@fnando
Copy link
Owner

fnando commented Nov 16, 2019

Sent previous message a little bit too early… 🤦‍♂️

The user agent from my iPad running Safari on ipadOS 13 is Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Safari/605.1.15.

The user agent we have on file for testing Safari 6 on iPad looks like this: Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25.

As you can see above, we don't have the iPad token anymore. There isn't much we can do at this point, so I'm closing this issue. If you find an alternative solution, please feel free to let us know.

@fnando fnando closed this as completed Nov 16, 2019
@maguri
Copy link

maguri commented Dec 4, 2019

🤷‍♂️ The only "[SOLUTION]" you can do as far as I know now, is to change your Safari Settings manually to set the userAgent as an iPad Request:

  • Open Settings -> Safari -> Request Desktop Website -> All websites. (is enabled by default) -> disabled it.

🙏 Just praying to Apple dev team to change it!

@fnando I think this issue shouldn't be closed, add some label if you want, but in my opinion should be Open

@zohaib-sarwar-confiz
Copy link

Anyone able to find some sort of solution to this problem. @fnando I agree with @maguri this issue should not be closed as it's not resolved. You are reducing changes, for this issue to get fixed by the rails community by closing it.

@mkbctrl
Copy link
Author

mkbctrl commented Jan 10, 2020

From technical perspective @fnando is kind of right. The issue is not directly the gem's issue, as the gem only reads what the browser sends.

In order to overcome that problem you would need to target iPad with it's screen size and dpi in example to make it work as you want.

@fnando fnando reopened this Jan 10, 2020
@fnando
Copy link
Owner

fnando commented Jan 10, 2020

@zohaib-sarwar-confiz As @mkbctrl mentioned, there's no fix for this other than manually changing your iPad's user agent or waiting for Apple to revert this change, as suggested by @maguri.

I'll left this issue open to give it more visibility. But once again, this cannot be fixed in any way by this gem.

Just found out Github's pinned tickets. I'm using that!

@fnando fnando pinned this issue Jan 10, 2020
@fnando fnando changed the title Support for Safari 13 iPadOS' Safari 13 is not being detected anymore Jan 10, 2020
@fnando fnando closed this as completed Jan 10, 2020
@fnando fnando mentioned this issue Jun 3, 2020
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

5 participants