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

iPad Pro webviews not detected #446

Closed
asad-imtiaz opened this issue Mar 18, 2020 · 7 comments
Closed

iPad Pro webviews not detected #446

asad-imtiaz opened this issue Mar 18, 2020 · 7 comments

Comments

@asad-imtiaz
Copy link

I am using browser gem's browser.platform.ios_webview? method to detect requests coming from iOS webviews.

It seems to work fine except for the iPad Pro. For iPad Pro this method returns false instead of true.

Any idea why this might be happening?

  • Rails version: 5.2
  • Browser gem version: 4.0.0
@fnando
Copy link
Owner

fnando commented Mar 19, 2020

Can you please post the user agent?

@asad-imtiaz
Copy link
Author

asad-imtiaz commented Mar 19, 2020

User Agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) AppName iOS"

@saikiransripada
Copy link

@fnando I ran into the same error. Is there any solution to this issue?

@fnando
Copy link
Owner

fnando commented Apr 6, 2020

I believe this is related to #404. There's nothing I can do, unfortunately.

@asad-imtiaz
Copy link
Author

@saikiransripada I got it to work.
Apparently, the platform on iPad Pro is not iOS, it is Mac OS. And according to the code in the gem, they determine that it is a webview by checking that the user agent should not contain "safari".

So, if the following is true then it's an iPad Pro webview:
browser.platform.name.downcase.include?('macos') && !request.user_agent.downcase.include?('safari')

this worked for me.

@fnando fnando closed this as completed May 9, 2020
@adrienpoly
Copy link

Thanks @asad-imtiaz you made my day

@QasimQureshi
Copy link

Testing the solution @asad-imtiaz suggests - in 2024 and iPadOS 17.1.1, the platform name iPad Pro 12.9 reports is "macintosh".

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