如何自动登录到一个网站? [英] How to Auto Login to a web-site?

查看:145
本文介绍了如何自动登录到一个网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我需要自动登录到网站。这是一个仪表板。是否有一个URL链接code,我可以创建快捷方式链接或的VBScript code来实现这一目标?也有一个 的AppleScript 作为MAC?


解决方案

下面是一个创建隐藏在当前页面的底部,一个div形式一个JavaScript书签的一个例子,然后提交它。 (我包括时间戳的原因很多仪表盘登录在表单中隐藏的时间戳字段)。

<$p$p><$c$c>javascript:self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);document.body.appendChild(document.createElement('div')).innerHTML='<form%20name=\"BletForm\"%20method=\"POST\"%20action=\"https://secure.mysite.com/index.asp?action=login\"><input%20type=\"hidden\"%20name=domain%20value=mydomain%20/><input%20type=\"hidden\"%20name=\"username\"%20value=myname%20/><input%20type=\"hidden\"%20name=\"password\"%20value=mypassword\"%20/><input%20type=\"hidden\"%20name=\"hidDateTime\"%20id=\"idhidDateTime\"%20value=\"\"%20/></form>';document.getElementById('idhidDateTime').value=+new%20Date()%20/1000%20|0;document.forms%5B'BletForm'%5D.submit();

您可以使用code一起为一个AppleScript的解决方案做的JavaScript的Safari。是这样的:

  JS集code为document.body.app ......
告诉应用程序野生动物园
    做的JavaScript JS code窗口1当前标签
告诉结束

Hello,

I need to login to a web-site automatically. It is a dashboard. Is there a URL link code which I can create as shortcut link or VBScript code to achieve this? Also is there a AppleScript for MAC?

解决方案

Here's an example of a javascript bookmarklet that creates a form hidden in a div at the bottom of the current page and then submits it. (I included a time stamp cause many dashboard logins include a hidden timestamp field in the form.)

javascript:self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);document.body.appendChild(document.createElement('div')).innerHTML='<form%20name="BletForm"%20method="POST"%20action="https://secure.mysite.com/index.asp?action=login"><input%20type="hidden"%20name="domain"%20value="mydomain"%20/><input%20type="hidden"%20name="username"%20value="myname"%20/><input%20type="hidden"%20name="password"%20value="mypassword"%20/><input%20type="hidden"%20name="hidDateTime"%20id="idhidDateTime"%20value=""%20/></form>';document.getElementById('idhidDateTime').value=+new%20Date()%20/1000%20|0;document.forms%5B'BletForm'%5D.submit();

You can use that code along with do javascript in safari for an Applescript solution. Something like:

set jsCode to "document.body.app..."
tell application "Safari"
    do JavaScript jsCode in current tab of window 1
end tell

这篇关于如何自动登录到一个网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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