Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In another question on this site, someone recommended creating a bookmark with the following javascript in the URL box to automatically fill in your user name and password on a website in Chrome:

javascript:function%20enterLogin(){username="your_username";password="your_password";document.getElementById('user_name').value=username;y=document.getElementById('password').value=password;}enterLogin();

My question is whether there is any way to alter this code so that it sends an "enter" key press to the browser after it enters your user name and password (to eliminate one more step).

share|improve this question

2 Answers 2

up vote 1 down vote accepted

You could modify the code to look like this:

javascript:function%20enterLogin(){username="your_username";password="your_password";document.getElementById('user_name').value=username;y=document.getElementById('password').value=password;document.forms["your_form"].submit();}enterLogin();

Just replace your_form with the name of your form.

share|improve this answer

I don't think this is possible, but you can submit the form using JavaScript:

document.forms["myform"].submit();

You just need the id of the form you want to submit in JavaScript — if there's no ID, you can use the index of the form (a number greater than or equal to 0). Since this is site specific, just test a bit to see what works.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.