【问题标题】:Android Webview (Phonegap): Disable Autocorrect, Autocapitalize and autocomplete doesn't workAndroid Webview(Phonegap):禁用自动更正、自动大写和自动完成不起作用
【发布时间】:2011-10-21 12:33:46
【问题描述】:

我在 Android (Phonegap) 上的 Web 视图中加载的登录页面有问题。 我为我的输入字段和表单标签使用了属性autocorrect="off" autocomplete="off" autocapitalize="off",但它不起作用。当我输入字母或数字时,设备会显示相似的单词,并且内容会上下波动。

有人知道我该如何解决这个问题吗?

干杯

【问题讨论】:

    标签: android webview cordova


    【解决方案1】:

    我有同样的问题,在谷歌上搜索了几个小时后,我终于找到了解决方案

    使用了以下属性

    autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"

    我在 android 4.2 和它的工作上测试了它

    Turn off predictive text for password field on websites

    【讨论】:

      【解决方案2】:

      我认为这些属性不适用于 Android。它们是特定于 iPhone 的。自动更正选项通过 Android 中的主要设置进行配置。

      【讨论】:

      • 请按照下面@chandan 的回答。现在在新版本的 Android 中似乎有一些选项。
      【解决方案3】:

      您应该尝试使用cordovasoftkeyboard 插件并在输入文本焦点上显示它,在模糊时隐藏它。这为我避免了很多奇怪的行为。但是,这将始终显示基本的软键盘(不是数字软键盘、电子邮件软键盘等...)

      $(document).on({
              blur : function(){
      
                  if(OS = "and")
                      cordova.plugins.SoftKeyboard.hide();
      
              },
              focus : function(e){
      
                  if(OS = "and"){
                      e.preventDefault();
                      cordova.plugins.SoftKeyboard.show();
      
                      if(Windows.currentWindow == null){
                          $('html, body').stop().animate({//permet de scroller l'input en haut
                              scrollTop: ($(this).offset().top)-80//header
                          }, 800);
                      }
                      return false;
                  }
              }
          }, ':input[type="text"],[type="number"],[type="email"]');   
      

      https://github.com/phonostar/PhoneGap-SoftKeyboard

      【讨论】:

        【解决方案4】:

        我刚刚发现!,您只需在输入中添加:name="password" 即可解决。

        【讨论】:

        • 在大多数表单中,您需要 name 属性来了解它的用途。
        • 确实非常有创意的解决方案:)
        猜你喜欢
        • 2013-11-02
        • 1970-01-01
        • 2019-03-15
        • 1970-01-01
        • 2012-07-10
        • 1970-01-01
        相关资源
        最近更新 更多