本文介绍了允许Chrome扩展弹出窗口内的表单自动填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了一个Chrome扩展从使用JSON到外部源的形式传递数据。不过,我想允许用户保存自己的用户名和密码,须提交该数据。我试图加入的X autocompletetype属性,我的投入也没有用。

如何才能让用户保存该信息,或者让Chrome自动填充这些投入?

 < D​​IV CLASS =COL-6>
  用户:LT;输入类型=文本名称=用户名ID =用户名价值=级=表格控要求的X autocompletetype =用户名>
< / DIV>
< D​​IV CLASS =COL-6>
  传:LT;输入类型=密码NAME =密码ID =密码值=级=表格控要求的X autocompletetype =密码>
< / DIV>


解决方案

从我的测试经验,在X自动完成标签确实没有在最新的Chrome版本。相反,尝试在输入标签使用自动完成标记,并根据HTML规范这里http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#autofill-field

例如:

 <输入名称=用户名自动完成=用户名类型=文本占位符=用户名需要>

也请记住父形式标记需​​要开和方法=POST自动完成=。
希望它的工作原理。

I've built a Chrome Extension which passes data from a form using json to an external source. However, I would like to allow users to save their username and password which are required to submit the data. I have attempted adding x-autocompletetype attributes to my inputs to no avail.

How can I allow users to save this information, or make Chrome autofill these inputs?

<div class="col-6">
  User: <input type="text" name="username" id="username" value="" class="form-control" required x-autocompletetype="username">
</div>
<div class="col-6">
  Pass: <input type="password" name="password" id="password" value="" class="form-control" required x-autocompletetype="password">
</div>
解决方案

From my experience of testing, the x-autocomplete tag does nothing in the latest chrome version. Instead try to use autocomplete tags on your input tags, and set their values according to the HTML spec here http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#autofill-field .

For example:

<input name="username" autocomplete="username" type="text" placeholder="username" required>

Also keep in mind that the parent form tag needs autocomplete="on" and method="POST".Hope it works.

这篇关于允许Chrome扩展弹出窗口内的表单自动填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 03:51