Log in

View Full Version : How do I make a Javascript or some script to automatically log to secure website?


cozoDOP2
Nov 22, 2010, 09:35 PM
An annoying website at work we use it to check uploaded files. Well, it is set up to log you off every few minutes.. so we have to keep entering the same thing . I was wondering if there was a way to login automatically using a script , whenever you go to the login page.

I only know javascript.. do I have to learn something else?

ITstudent2006
Nov 22, 2010, 09:58 PM
http://www.computing.net/answers/programming/auto-login-script/14250.html

Notsure if this helps but its got useful info.

ITstudent2006
Nov 22, 2010, 10:44 PM
I have played with the script for Facebook and I've got it almost figured out. I can edit the script to auto fill my username and password but I'm still working on it submitting the login.

That way I can put the edited script on my desktop as an html icon and clickand auto login to Facebook.

Ill let you know if I figure it out!

ITstudent2006
Nov 22, 2010, 10:48 PM
However, I am using Chrome as my browser, when I open it with IE I get active X/script security messages. Hmm

objectundefined
Jan 22, 2011, 12:26 AM
In short, if you're using a modern browser like chrome, safari or Firefox, you would use vanilla javascript to find the form elements you care about, edit their values, and then submit the form. The function you'd use is document.querySelectorAll().

Example:



document.querySelectorAll('form#login input#username')[0].value = " *YourUserName* ";
document.querySelectorAll('form#login input#password')[0].value = " *YourPassword* ";

document.querySelectorAll('form#login')[0].submit();

// or document.getElementById('login').submit();




in order to execute this safely from the URL bar, you should wrap it in a closure.




javascript:(function(){ ... })()