问题
i'm loading a page with HTML5 validated elements, and using methods like "required" and max-length, they work on Android WebViews but not in iOS's.
Is there a way to support that and other HTML5 functions that I use? or i always have to write my own validation methods?
回答1:
Safari does not fully support form validation: http://caniuse.com/#feat=form-validation
You can either write your own JavaScript-based validation, or use an existing polyfill.
Update: Safari 10.1 includes full interactive form validation.
回答2:
It worked for me in the WKWebView! If you using Cordova, have a look at https://github.com/apache/cordova-plugin-wkwebview-engine. It's simple to integrate.
来源:https://stackoverflow.com/questions/37323914/html5-form-validation-not-working-in-ios-uiwebview