问题
HTML5 has a new input type named "number". On most mobile smartphones this brings up a numeric keypad. On pre-html5 phones the type falls back to "text" and we are OK. Yet, on some models the numeric keypad does not have a period and one cannot click the "symbols" button to add one. Known models with this flaw are:
- Samsung Galaxy S4, see: Missing period for Samsung Galaxy S4 numeric keypad
- Samsung Galaxy Note II
- Samsung Galaxy Tab 2 10". see: Samsung Galaxy Tablet does not allow entering floating point numbers to inputs with "number" type
- ????
What other models? Older Samsung Android 2.2 phone does not have this problem. Other Android devices such as Nabi Tab do not have this problem. I read the Galaxy S3 did not have this problem.
See related discussion:
- <input type="number"> in Firefox. Why doesn't Mozilla support number inputs in its browser?
- HTML5 - input=number and incompatible browsers
- HTML5 input type number vs tel
Also, not noted on those is that input type="tel" works fine for iPad but does not work as a replacement for number on an iPhone. So, a webapp must determine the device model or else resort to input type="text".
What phone and tablet models incorrectly interpret input type="number"
as a whole, non-decimal input keyboard?
回答1:
It turns out to be all SAMSUNG with 4.x as well as HTC with 4.4 and reports of other vendors (Xperia). Long story short, at least put in the fix for anything with User-Agent having SAMSUNG or HTC and running 4.x; but possibly put in the fix for anything having ANDROID.
回答2:
I have discovered a work around for this problem. It works for my Samsung Galaxy S2 phone and I suspect it will work for all Samsung devices that suffer from the "missing decimal point" problem on the numeric keyboard. Hopefully others with different Samsung devices can check this solution and report their findings.
Unfortunately, it is a client based (phone owner) solution so it does not really help from a web developer standpoint. Here is the solution that worked for me:
- While in the browser click on the menu icon (bottom left of phone)
- Select Settings
- Select Privacy and Security
- Scroll down and uncheck "Remember Form Data" and select "Clear Form Data"
- Click OK to confirm
After following this procedure, the numeric keypad should show an extra button labelled .- That is, the same button is used for both minus signs and decimal points. Double-click this button to get a minus sign (provided the field is currently empty) and single click to get a decimal point.
来源:https://stackoverflow.com/questions/23205511/what-models-of-samsung-smartphones-have-missing-period-for-html5-input-type-num