Many here know about the one-click access to AdSense account which works great:
<form method="post" action="https://www.google.com/adsense/login.do" name="login">
<input type="hidden" name="destination" value="">
<input type="hidden" name="username" value="{USER_NAME}">
<input type="hidden" name="password" value="{PASSWORD}">
</form><body>
<script language="javascript">
document.login.submit();
</script>
</body>
Now, I'm trying to do the same with AdWords login:
<form action="https://adwords.google.com/select/LoginValidation" name="loginform" method="POST">
<input type="hidden" name="javascriptEnabled" value="true">
<input type="hidden" name="hl" value="en_US">
<input type="hidden" name="mkc" value="0">
<input type="hidden" name="resendemail" value="false">
<input type="hidden" name="login.userid" value="{USER_NAME}">
<input type="hidden" name="login.password" value="{PASSWORD}">
<input type="submit" name="login" value="Login">
</form><body>
<script language="javascript">
document.loginform.submit();
</script>
</body>
However, when the javascript is executed, it does not login into the AW account, it is like AW is redirecting back to the login page. I tested the page exactly the same but without automatically submiting the form with javascript, so I just have to click in the 'Login' button and it works fine, but when I enable the automatic submit using the javascript code it does not work.
Can any JavaScritp/Forms guru here let me know what I'm missing?
TIP: The original form from the AW login page does not have a 'name' attribute which is nedeed for the javascript to be able to call the submit method. So the name="loginform" attribute is mine, I did name the form to be able to use the javascript, anyway, when I test the form without the javascript even having the 'name' attribute for the form it works!. You can try just commentin and un-commenting back the document.loginform.submit(); line, that's all!
I hope you can help me ;-)... it has become personal now :-).
Thanks!
CS.