banner
李大仁博客

李大仁博客

天地虽大,但有一念向善,心存良知,虽凡夫俗子,皆可为圣贤。

[CSS] Browser IME Input Method Control Prohibits Inputting Chinese

In the usual HTML development process, the control of prohibiting Chinese input for text type input controls is generally implemented through JavaScript. It determines whether the input is entered into the control by judging the character encoding range of the text entered by the user. In CSS3.0, you can directly use styles to control the input method settings of input controls by setting the ime-mode of the object style. The optional values are: auto: does not affect the status of IME. active: specifies all characters entered using IME. That is, activate the local language input method. Users can still undo the activation of IME. inactive: specifies all characters not entered using IME. That is, activate non-local language. Users can still undo the activation of IME. disabled: completely disable IME. For focused controls (such as input boxes), users cannot activate IME. normal: normal IME status. (Not supported by IE, not recommended)

Example code:

/*Chrome Safari*/
-webkit-ime-mode: auto | active | inactive | disabled
/*Mozilla Firefox*/
-moz-ime-mode: auto | active | inactive | disabled
/*Opera*/
-o-ime-mode: auto | active | inactive | disabled
/*Internet Explorer*/
-ms-ime-mode: auto | active | inactive | disabled
/*CSS3 Standard*/
ime-mode: auto | active | inactive | disabled

However, it seems that the above methods have been ineffective in Chrome 30.0.1599.69 m, so currently, you can only manually control it by combining JavaScript. It is recommended to consider the following methods during development.

//\u4e00-\u9fa5 is the encoding range for Chinese characters

If it is mobile HTML5 app development, you can use the following methods

Reference URL: http://stackoverflow.com/questions/15520410/disable-ime-mode-google-chrome

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.