在MS Edge中禁用表格填写 [英] Disable Form Completion in MS Edge

查看:118
本文介绍了在MS Edge中禁用表格填写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一种方法来禁用Microsoft Edge中的功能,该功能可在页面刷新时保持表单值(尤其是输入)不保留其值.您可以在此页面上查看名字姓氏示例 https://www.tutorialspoint.com /html/html_forms.htm 查看行为.在Edge上,如果您在输入字段中键入并立即刷新页面,则将在页面完全重新加载后发现值仍然存在.我已经尝试过在Edge浏览器设置中禁用该选项,并且还设置了autocomplete ="off",但是这些似乎都不起作用.我专门尝试在Angular 2中执行此操作,但我发现该行为直接影响Edge浏览器内部的HTML.

I am trying to find a way to disable the feature in Microsoft Edge, that keeps form values, specifically inputs, from retaining their value when a page refreshes. You can look at the first name last name example on this page https://www.tutorialspoint.com/html/html_forms.htm to see the behavior. On Edge, if you type in the input field and immediately refresh the page, you will find the values are still present after the page has reloaded completely. I have tried this with the option disabled in the Edge browser settings and I have also set autocomplete="off" but neither of these seems to have any effect. I am specifically trying to do this within Angular 2, but i've found that the behavior directly affects the HTML inside of the Edge browser.

推荐答案

答案很差,但这是MS Edge开发人员在评论链接中的报价

This is a poor answer but here is a quote from an MS Edge developer from the link in the comment

在IE11和Edge中,我们决定忽略autocomplete = off

In IE11 and Edge, we made the decision to ignore autocomplete=off

此处

这完成了,看来:

提供更高的用户价值.

to provide increased user value.

我的解决方案是选择表单字段,然后在重新加载时使用javascript清除它.例如:

My solution is to select the form field and clear it using javascript on a reload. E.g.:

document.querySelector("#theInput")
   .addEventListener("load", function (event) { event.target.value = "" } )

这篇关于在MS Edge中禁用表格填写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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