Create a Lightning Documentation Bookmarklet

What Problem is Being Solved?

Salesforce Lightning is a great platform and one of the cool “features” is that it encourages the developers to document their Lightning components using the tags. The platform will then dynamically build documentation specific to your org.

One minor gripe I have is needing to remember the path to the documentation. Even though it is as simple as /auradocs/reference.app I don’t want to have to remember it. I decided to create a bookmarklet that would open a new tab with the documentation. Now I just need to be logged into Salesforce and have it open in the active tab. Clicking the bookmarklet will open the documentation for that org.

The Bookmarklet Code

javascript:(
	function() {
		if(window.location.host.indexOf('force.com') >= 0) {
			window.open(window.location.protocol + '//' + window.location.host + '/auradocs/reference.app');
		} else {
			alert('You are not in a salesforce org!');
		}
	}
)();

Add This Bookmarklet to Your Browser

Installing this bookmarklet is as easy as dragging the below link up to your bookmarks bar.

Lightning Documentation <— This is the link!

Now you just need to click on the bookmark while in your Salesforce org and your Lightning Component documentation will pop open in a new tab.