Wednesday, August 12, 2009

Javascript to Login a Webpage

If you have a username and password for a webpage and you want to login the website without clicking login button.

Small Hack:

<script language="javascript" type="text/javascript">
document.forms[0]._some_junkvalues_txtLoginId.value = "username";
document.forms[0]._some_junkvalues_txtPassword.value = "password";
document.forms[0]._some_junkvalues_btnLogin.click();
</script>


Goto the webpage right click ->View Source ->search for txt box which accepts login & password,usually these id's are preceded with "_" values so copy that and paste it in your script.
Same do a search for login button and use click() function to activate login button event.

Here document.form[0].submit; wont work.

No comments:

Post a Comment