[英]How to pre-fill text fields and click the submit button of a URL
I want to open a URL, eg http://www.facebook.com . 我想打开一个URL,例如http://www.facebook.com 。 How do I open it from one page and set the values of the input field to my credentials and auto click the login button.
如何从一页打开它,并将输入字段的值设置为我的凭据,然后自动单击登录按钮。 I found the following code snippet:
我发现以下代码片段:
<p>Your name:
<br /><input name="name" id="name" /></p>
<p>Your email:
<br /><input name="email" id="email" /></p>
<script>
var hashParams = window.location.hash.substr(1).split('&'); // substr(1) to remove the #
for(var i = 0; i < hashParams.length; i++){
var p = hashParams[i].split('=');
document.getElementById(p[0]).value = decodeURIComponent(p[1]);;
}
That produces this URL: www.xyz.com/contact.html#name=some_text&email=more%20text&username=john&age=23
. 产生此URL:
www.xyz.com/contact.html#name=some_text&email=more%20text&username=john&age=23
。 (no credits taken). (不计学分)。
But I am not sure where to enter the URL to hit. 但是我不确定在哪里输入要命中的URL。
Inspect the page and find the login field in the HTML. 检查页面并在HTML中找到登录字段。
For Facebook, use: 对于Facebook,请使用:
document.getElementById("email").innerHTML = "YourEmail";
document.getElementById("pass").innerHTML = "yourpass";
In the URL, try adding 在网址中,尝试添加
<script>document.getElementById("email").innerHTML = "YourEmailhere";
document.getElementById("pass").innerHTML = "yourpasshere";</script>
after Facebook.com 在Facebook.com之后
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.