自动填写特定的登录表单

问题描述 投票:1回答:1

有没有可能填写特定的登录表单作为Pinterest的JavaScript?

这是链接 - https://www.pinterest.com/login/

一些提示:

登录字段的ID是“电子邮件”

密码字段的id是“密码”

没有机会通过以下方式填写:

document.getElementById("email").value = "username";
document.getElementById("password").value = "password";

因为单击“登录”或单击文本字段后输入的数据将消失。

javascript html
1个回答
0
投票

在这个答案中,我假设您拥有所需信息的变量。如果您希望浏览器为您自动填充,您可以在此处执行此操作:Enabling browser's form auto-filling

这是一个片段:

// You can change this to whatever you want to autofill
var username = "Anything You Want";

// window.onload makes sure that we are not trying to get the
// element before it is ready
window.onload = function() {
  // .value is because this is a input tag
  document.getElementById("username").value = username;
};
<input id="username">
© www.soinside.com 2019 - 2024. All rights reserved.