iPhone UIWebView - Can auto complete be turned off

2019-02-12 03:54发布

I've searched high & low for an answer on this and I can't seem to find an answer or anybody else having the same issue. Hope some one can assist?

I have a web page for signup which I'm viewing in an iPhone UIWebView. A user is asking if we can stop capitalization on the first letter of the email address being entered. I thought this didn't matter, but apparently it can for the local-part on some email systems (apparently it's only the domain that is only case insensitive).

It seems autocomplete is the culprit. I've tried adding autocomplete="off" to the input element in the html, but iOS is obviously ignoring it:

alt text

Can auto-complete be turned off on a html input text field within a UIWebView?

Thanks

2条回答
来,给爷笑一个
2楼-- · 2019-02-12 04:08

Seems like Apple have some documentation now:

Although the UIWebView class does not support the UITextInputTraits protocol directly, you can configure some keyboard attributes for text input elements. For example, you can include autocorrect and auto-capitalization attributes in the definition of an input element to specify the keyboard’s behaviors, as shown in the following example.

   <input type="text" size="30" autocorrect="off" autocapitalize="off">

You can also control which type of keyboard is displayed when a user touches a text field in a web page. To display a telephone keypad, an email keyboard, or a URL keyboard, use the tel, email, or url keywords for the type attribute on an input element, respectively. To display a numeric keyboard, set the value of the pattern attribute to "[0-9]" or "\d".

These keywords and the pattern attribute are part of HTML 5, and are available in iOS 3.1 and later. The following list shows how to display each type of keyboard, including the standard keyboard.

Text: <input type="text"></input>

Telephone: <input type="tel"></input>

URL: <input type="url"></input>

Email: <input type="email"></input>

Zip code: <input type="text" pattern="[0-9]*"></input>

http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html#Configuring the Keyboard for Web Views

查看更多
Ridiculous、
3楼-- · 2019-02-12 04:10

Add autocorrect="off" attribute to your input text field.

查看更多
登录 后发表回答