Thursday, December 18, 2014

A handy documentation bookmarklet

The bookmarklet challenge on Tridion Stackexchange inspired me to try my JavaScript skills and write my first bookmarklet. This bookmarklet is very Tridion related, although not really enhancing the Tridion GUI

Is shared the compact bookmarklet on gist, and the whole thing on GitHub.
Almost daily I log in multiple times into the SDL documentation portal, aka LiveContent or "The Manual". Unfortunately the browser does not remember the password for this site. This bookmarklet for the challenge fixes this problem and the browser remembers the login.

This is how to use this:
  1. Make a new bookmark
  2. Paste this script in the Location field of the bookmark (full source).
  3. Once on the LiveContent website just click the bookmarklet and the browser will offer to remember your credentials.
 

How this works

The browser does not try to remember the credentials for this site because the login form is not a proper HTML login form with a form tag and submit button. The bookmarklet hides the original login button and adds a new login button image, a form submit button and wraps the form in a form element. Clicking the new login button (just a clickable image) will set a series of events in motion. The new login button click triggers a click on the form submit button, the form submit triggers the browser to ask you to remember the credentials, the form submit action is to click the original login which sets some LiveContent mechanism in working.

I did not bother to study how the LiveContent login actually works and I think the beauty of this solution is that it leaves the original login page intact, it only adds and hides nodes in the dom document.

Note

I could have made a bookmarklet which logs you in directly, without leveraging the browser form auto completion, that would be even faster to use, but I do not like the fact that the bookmarklet would store the credentials, even if the credentials are not that sensitive and secret.

No comments:

Post a Comment