如何自动登录网站? [英] How to Auto Login to a web-site?
问题描述
你好
我需要自动登录网站.它是一个仪表板.是否有 URL 链接代码可以创建为快捷链接或 VBScript 代码来实现此目的?还有用于 MAC 的 AppleScript 吗?
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?
推荐答案
这是一个 javascript 书签示例,它创建一个隐藏在当前页面底部的 div 中的表单,然后提交它.(我包含了一个时间戳,因为许多仪表板登录在表单中包含一个隐藏的时间戳字段.)
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();
您可以使用该代码以及在 safari 中执行 javascript 以获得 Applescript 解决方案.类似的东西:
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屋!