A Grab Bag of Bookmarklets

A (semi-) frequently updated list of simple bookmarklets I’ve found somewhat useful. Some of the more complex ones for use on twitter.com (Custom filtering of the timeline and Hovercard removal) are discussed in more detail elsewhere on the site. The below are a collection of short and sweet bookmarklets that do a simple but effective job.


Quick Links

WHOIS Lookup

WHOIS is a protocol for finding out the contact details of the owner of a domain. Traditionally this information is accessed via the command line, however a number of websites now exist as wrappers for this information.

Sites such as Who.is allow accessing of domain ownership and contact info via a web browser. What’s particularly nice about the who.is site is that you can query any site by placing the domain name you wish to query at the end of the who.is url, i.e. http://who.is/whois/daft.ie will give WHOIS info for Daft.ie.

This simple WHOIS bookmarklet automates this process. Clicking this bookmarklet will query the WHOIS info for the site you’re currently on, via the who.is site. Copy the code below in to a new bookmarklet, or drag the WHOIS bookmarklet link above to your browser’s bookmarks bar.

1
window.location = 'http://who.is/whois/'+window.location.host;

Dual Site Toggle

This bookmarklet when you want compare the same page on two different sites which both use the same url structure, e.g. a local development environment (localhost) and the same page on the live server (example.com).
For this example, we’ll compare property result pages on Daft.ie with the same ones on the mobile version of the site, m.daft.ie.

First, we decide on the two sites between which we want to toggle.

1
2
var siteA = 'www.daft.ie';
var siteB = 'm.daft.ie';

Next we need to grab the filename of the current page, as well as any query string arguments. This value will stay the same between both sites.

1
2
3
4
5
6
7
8
9
10
11
// Store the filename and query string, where applicable
var sstr = '';
// Query string exists?
if(window.location.search.substring(1).length>1)
{
    sstr = window.location.pathname+'?'+window.location.search.substring(1);
}
else
{
    sstr = window.location.pathname;
};

Finally, we need to figure out which host we’re on, and then switch to the other one!

1
2
3
4
5
6
7
8
if(window.location.host.indexOf(siteA)==-1)
{
    window.location='http://'+siteA+sstr;
}
else
{
    window.location = 'http://'+siteB+sstr;
}

As it’s a bookmarklet, we need to compress it all down to one line.

1
javascript:var siteA = 'www.daft.ie';var siteB = 'm.daft.ie';var sstr = '';if(window.location.search.substring(1).length>1){sstr = window.location.pathname+'?'+window.location.search.substring(1);}else{sstr = window.location.pathname;};if(window.location.host.indexOf(siteA)==-1){window.location='http://'+siteA+sstr;}else{window.location = 'http://'+siteB+sstr;};

To use this toggle, you can either copy the above code to a new bookmarklet, or drag this a random house on Daft.ie (in this case, the house used by TV3′s The Apprentice), then click the bookmarklet to toggle between the mobile and web versions of the same page.

Updating this for any other pair of sites is as simple as editing the siteA and siteB variables in the bookmarklet.

Down for everyone, or just me?

Downforeveryoneorjustme.com is a site that comes in handy when trying to check whether a site being inaccessible is a problem with the site itself, or your local network. It will basically ping the server from a location different to your own, and see if it’s still available from there.

We’re basically doing the same thing here as we did for the WHOIS bookmarklet above, so:

1
window.location = 'http://www.downforeveryoneorjustme.com/'+window.location.host;

Dragging this DFEOJM bookmarklet to your browser’s bookmarks bar will let you check the next time you get a “server inaccessible” error message whether the problem is on your network or with the site itself.

Leave a Reply