1

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).

2 Answers 2

1

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.

3

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .