Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
661 views
in Technique[技术] by (71.8m points)

javascript - Prevent Samsung predictive text in HTML form

I have an HTML form with a text input field. As the user types, we do AJAX requests to get predictive text suggestions, based on a list of values in our database.

We display that list and the user can select one of them; then we show them the rest of the form.

If you're viewing our web page on a Samsung Galaxy S4, in its built-in browser or Chrome or Firefox, the device's predictive input suggestions also appear as the user types. e.g. see the screenshot:

enter image description here

It's easy enough for an individual user to disable this in the settings on their own phone. However we want to make it so it's always disabled for this field for all users. We're already doing all the following, which don't seem to prevent it appearing:

<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">

You can also see this here.

Any suggestions?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I've tried different things and it seems that on mobile you currently have no chance to do this in a proper way.

According to Safari Developer Docs there is support https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/Attributes.html but it seems that this is more related to the Desktop Safari than iOS.

Additionally, spellcheck could do it but currently, according to http://caniuse.com/#feat=spellcheck-attribute :

The partial support in mobile browsers results from their OS generally having built-in spell checking instead of using the wavy underline to indicate misspelled words. spellcheck="false" does not seem to have any effect in these browsers.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...