Safari浏览器保存的密码覆盖自动完成= QUOT;关闭"在形式 [英] Safari saved passwords are overriding autocomplete="off" in forms

查看:168
本文介绍了Safari浏览器保存的密码覆盖自动完成= QUOT;关闭"在形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做了一吨的对这一问题的研究,但我似乎无法找到任何解决我的问题。

I have done a ton of research towards this issue, but I can't seem to find anything that solves my problem.

我已经自动完成=关闭我的表单标签设置,以及我所有的输入标签为好,但Safari浏览器继续输入自动保存的密码进入我的页面加载的形式,这是造成窗体上的意外keydown事件在我的JavaScript。

I have autocomplete="off" set on my form tag, and all of my input tags as well, yet Safari continues to input auto saved passwords into my form on page load, which is causing an undesired keydown event on the form in my JavaScript.

有什么想法?我已经试过各种黑客就像是从code删除这些输入字段完全,然后使用JavaScript和setTimeout的几秒钟后,将它们插入到页面中,但即使以后Safari在其保存的密码仍然抛出我的投入。

Any thoughts? I've tried all sorts of hacks like deleting those input fields from the code entirely, and then using javascript and a setTimeout to insert them into the page after a few seconds, but even after that Safari still throws in its saved passwords to my inputs.

我也使用自动更正=关闭和autocapitalize =关闭属性在我和标签审判。

I've also tried using the autocorrect="off" and autocapitalize="off" attributes in my and tags.

我试过的Javascript黑客就像这样(举例):

I've tried Javascript hacks like so (example):

$(function() {
    $('input').attr('autocomplete', 'off');
});

这样在加载页面上的每个输入字段都有这个属性,但Safari浏览器仍插入其保存的密码到田间地头。

So that every input field on the page on load has this attribute, and yet Safari still inserts its saved passwords into the fields.

是,该页面使用HTML5的doctype(因为我知道会自动完成没有它的工作)。

Yes, the page is using html5 doctype (Because I know autocomplete won't work without it).

下面是我的code:

  - form_for @website, :html => {:class => 'fields', :autocomplete => 'off'}, :url => {:controller => 'signup', :action => 'connect'} do |form|
    %h3 Enter URL
    %ol.fields
      %li
        = form.label :url, "Website URL:"
        = form.text_field :url, :placeholder => "Website URL", :autocomplete => "off", :class => "website_url"
    %h3 Enter Credentials
    - form.fields_for :authentication do |aa|
      %ol.fields
        %li
          = aa.label :hostname, "SFTP/FTP Server:"
          = aa.text_field :hostname, :placeholder => "SFTP", :autocomplete => "off"
        %li
          = aa.label :account, "Username:"
          = aa.text_field :account, :placeholder => 'Username', :autocomplete => "off"
        %li
          = aa.label :password, "Password:"
          = aa.password_field :password, :placeholder => 'Password', :autocomplete => "off"

以上是在HAML。这是一个Ruby应用程序。它插入我的密码进入:帐户输入,:密码输入。我已经试过包装我的'名字'部分:帐户输入span标签,像这样:

The above is in haml. It is a ruby application. It is inserting my passwords into the :account input, and the :password input. I have tried wrapping the 'name' part of my :account input in span tags like so:

User<span>n</span>ame

因为'名'字是用于自动保存密码的触发器,然而这在尝试解决这个野生动物园后,仍抛出其保存的密码进入我的表格。

because of the 'name' word being a trigger for autosaved passwords, yet safari still throws its saved passwords into my form after that attempt at solving this.

我将不胜AP preciate一些新的提示,我可以尝试。一切到目前为止,我已经找到了这一问题,人们只是说使用自动完成=关闭。我是,但它不工作!

I would greatly appreciate some new tips I could try. Everything I've found so far for this problem, people just say "use autocomplete="off." I am, but it's not working!

另外,我一直在使用Safari 6.1.2测试这一点,但已经证实与新旧版本的Safari浏览器的这种奇怪的行为也是如此。链接到浏览器的截图进行检查,所以我知道自动完成=关闭属性正确添加的元素:的http:/ /imgur.com/Sgqn7A4

Also, I've been testing this with Safari 6.1.2, but have confirmed this strange behavior with older and newer versions of Safari as well. Link to screenshot of browser inspect, so I do know the autocomplete="off" attribute is properly being added to the elements: http://imgur.com/Sgqn7A4

推荐答案

貌似Safari浏览器,和其他人已经决定停止履行该属性。

Looks like Safari, and others have decided to stop honoring this attribute.

<一个href=\"https://discussions.apple.com/message/25149138#25149138\">https://discussions.apple.com/message/25149138#25149138

<一个href=\"http://blog.gerv.net/2013/10/ie-11-ignoring-autocompleteoff\">http://blog.gerv.net/2013/10/ie-11-ignoring-autocompleteoff

// Override Safari, Chrome and IE11 decision to ignore autocomplete: off
// on form you wish to skip autocomplete, change all password fields to type=private
// requires jQuery

$(function() {
  $('input[type="private"]').focus(function(e){
    $(this).prop('type', 'password');
  });
  $('input[type="private"]').parents('form').submit(function(){
    $(this).find('input[type="password"]').hide().prop('type', 'private');
  });
});

这篇关于Safari浏览器保存的密码覆盖自动完成= QUOT;关闭&QUOT;在形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆