Skip to content

Instantly share code, notes, and snippets.

@sportebois
Created October 18, 2013 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sportebois/7046921 to your computer and use it in GitHub Desktop.
Save sportebois/7046921 to your computer and use it in GitHub Desktop.
Detect if you're using an old version of Safari on iOS that do not support file upload (input="file"), i.e. if your iOS version is older than 6
/**
* @return Boolean
*/
function fileUploadIsSupported() {
'use strict';
// Look for mobile iOS 4 or 5
return !(/(iPhone|iPad|iPod)(;)?(\s\w;)?(\s)?(CPU)?(\s)?(\sOS\s)(3|4|5)/.test(navigator.userAgent));
}
(iPhone|iPad|iPod)(;)?(\s\w;)?(\s)?(CPU)?(\s)?(\sOS\s)(3|4|5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment