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

Adding UIWebView auto initialization of buggyfill. #7

Merged
merged 2 commits into from Apr 16, 2014

Conversation

tylerstalder
Copy link
Contributor

UIWebView has the same issues as Mobile Safari when using viewport
units. This change makes the regex that matches Mobile Safari more
generic to match what UIWebViews report in iOS.

Tested on:

  • iOS Simulator UIWebView
  • iOS Simulator Mobile Safari
  • iOS 7 Mobile Safari
  • iOS Twitter
    Client UIWebView.

UIWebView User Agent

"Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D167"

Mobile Safari User Agent

"Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D167 Safari/9537.53"

UIWebView has the same issues as mobile safari when using viewport
units. This change makes the regex that matches Mobile Safari more
generic to match what UIWebViews report in iOS. Tested on iOS Simulator
UIWebView, iOS Simulator Mobile Safari, iOS 7 Mobile Safari, and iOS Twitter
Client UIWebView.

UIWebView
"Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X)
AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D167"

Mobile Safari
"Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X)
AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D167
Safari/9537.53"
@rodneyrehm
Copy link
Owner

I wonder if that is specific enough. Wouldn't this expression be more specific?

var is_safari_or_uiwebview = /(iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent);

@tylerstalder
Copy link
Contributor Author

That looks like a better and more accurate version. Updated.

rodneyrehm added a commit that referenced this pull request Apr 16, 2014
Fixing browser detection to add UIWebView
@rodneyrehm rodneyrehm merged commit 3ea1e50 into rodneyrehm:master Apr 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants