2010-04-14 22:10

Bookmarklets are links containing Javascript code. They are useful when you save them in your bookmarks, in order to achieve some processing on the current page displayed in your browser.

It is possible to create bookmarklets authenticating you on a site with a login form. Note that it requires storing your login and passwordin the bookmarklet source code.

Login bookmarklet example

The bookmarklet code on several lines:

javascript:
document.body.appendChild(document.createElement('div')).innerHTML='
<form name="BletForm" method="POST action="http://www.woozweb.com/loginctrl">
<input type="hidden" name="login" value="MONLOGIN" />
<input type="hidden" name="pass" value="MONPASS" />
</form>';
document.forms['BletForm'].submit();

This code generates a POST HTTP request with two parameters, from your bookmarks. Writing this kind of code is easy for Web developpers, but hard for regular users.

So I wrote a bookmarklet that itself can generate login form bookmarklets, easily.

It’s very simple:

  1. Drag the generator bookmarklet in your bookmarks:
    generator
  2. Open a web page with a login form.
  3. Click on the generator in your bookmarks: a message appears next to the form.
  4. Fill in the login form.
  5. Click on the generation link: the bookmarklet appears.
  6. Drag the generated bookmarklet in your bookmarks.
  7. Finally, test your automatic login bookmarklet!

The generator bookmarklet even works with the login screen of my bank account. Obviously, your login information is stored directly in the bookmark, which is not very secure…

Notes:

  • Only tested with Firefox. Some work to make it compatible with Safari and IE.
  • Find a way to use Firefox password storage to retrieve the password.
  • If the bookmarklet doesn’t work for you, give me some feedback.

Links:

2010-04-14 22:10 · Tags: , ,

11 Comments

  1. Thank you. This worked beautifully.
    Regards
    Julian

    Reply

  2. Great !
    I’m glad you tested it.
    Marc

    Reply

  3. <a href=”http://www.coachfactoryonline.com/“>coach bags</a>
    <a href=”http://www.coachfactoryonline.com/“>coach outlet</a>
    <a href=”http://www.coachfactoryonline.com/“>coach factory online</a>zocy00007 01.25

    Reply

  4. The fee would also cover costs associated with inspection of the system and having the service available to <a rel=”nofollow” href=”http://www.ssornaments.com“>Christmas decorations</a> properties.

    Reply

  5. This year we have flower arrangements, special balloons, chocolates and <a href=”http://www.southdoll.com/blog/Soft-toys/“>Soft toys</a>.” The ever-popular dozen red roses was still a big seller, she said.

    Reply

  6. How do i modify this code in order to save it in database ? Is it possible ?

    Reply

  7. It worked great for a few hours, but then it just brings up the login page with the message “This session has timed out.”
    Ideas?

    Reply

  8. Seems don’t work on “Outlook Web App”, no effect when “generator” is clicked.

    Reply

    • Or maybe because “The server’s certificate is not trusted by chrome”, dunno.

      Reply

      • I just tested with Firefox on outlook.com and it seems to work fine. When clicking the generator bookmark, this message is displayed : “Fill the form, then
        Click here to generate the bookmarklet !”
        Maybe try it with Firefox.

        Reply

Leave a Reply to dooblem Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>