我的客户希望在他的网站上放置一个按钮,在第三方网站上触发他们不主持或无法访问服务器的操作,这意味着现在代码必须嵌入到HTML代码中。< / p>
该按钮不公开,它是某些员工的通用登录。
<!doctype html>
<html>
<head>
<title>Add a Lead</title>
</head>
<script type="text/vbscript">
sub Execute()
Dim IE
Dim WRI
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = 1
IE.navigate "http://rentalapp.zillow.com/"
Do While (IE.Busy)
WScript.Sleep 10
Loop
Set WRI = IE.document.getElementByID("username")
WRI.Value = "username"
Set WRI = IE.document.getElementByID("password")
WRI.Value = "password"
Set WRI = IE.document.Forms(0)
WRI.Submit
WScript.Sleep 1000
IE.navigate "http://rentalapp.zillow.com/leads/add/"
end sub
</script>
<body>
<button onClick="Execute()">Add A Lead</button>
This is supposed to fire off the method called execute.
</body>
</html>
答案 0 :(得分:3)
将其转换为JavaScript无济于事。从浏览器内部操作可以为您提供完全不同的API和安全限制,然后从外部控制浏览器。
如果有任何解决方案可以解决此问题,那么它是一个简单的HTML表单,其操作设置为您要登录的站点(以及带有一些隐藏输入的提交按钮)。
如果该网站在其登录表单上实施CSRF保护,则无法达到预期效果。