This bookmarklet will tell us whois the current owner of any website

Photo by ~Brenda-Starr~

A bookmarklet is a bookmark that contains a JavaScript program instead of a URL. The JavaScript code has access to the current page, and can operate on it, change it, or direct to a new page based on it.

To install a bookmarklet, create a new bookmark, and paste the code into the address part. For FireFox, Chrome, and some other browsers, you can drag a bookmarklet onto the bookmark bar.

I previously wrote a blog post about a bookmarklet that lets you edit most any webpage you visit. Today I would like to present a bookmarklet that I am the latest author of. It is based on a bookmarklet that doesn’t work anymore called domain owner. I simplified it a bit, made it work again, and I direct it to a better whois service. I call my bookmarklet whois, but you can name it anything you like when you save it.

So right click on whois and save bookmark, or if you can, drag whois to your bookmark bar. You have installed the bookmarklet.

Now to use it, just visit any website that you want to know who the owner is, and click the bookmarklet button.

The code for this bookmarklet is as follows:


We first inform the browser that this is code with javascript:. We then create an anonymous function, an unnamed function, that executes in place so that We don’t return a value. We declare two variables p and h that will be used in a moment. The %20 is a URL encoded space character. Read it as a space. needs to be explained in parts. location is an object that represents the current web address displayed in the browser. specifies the .host method to the object that represents just the hostname portion of the address. Strictly speaking, .host will also return the port number of the URL if it differs from the default. In that case, my bookmarklet will break. That is not a problem for most uses. The .split is a method that splits the string into separate strings based on a regular expression or a separator. In this case We are splitting on a period (‘.’). So returns an array of each of the parts between the periods in the current web page and stores it in the variable h. Next, p=h.length uses the .length array method to find the number of elements stored in array h and puts the result in variable p. The variable p now lets us choose which piece of the domain name we want. location is used again, but this time we create a new URL and set location to it. This redirects the browser to the new URL location. followed by any domain name will return a page with the whois information for that domain name. The + (plus) operator concatenates two strings. For website, to use an example, h[p-3] is www, h[p-2] is HowTutorial, and h[p-1] is com. The .split method had stored each of the parts in the array h. The [] lets us select one element of the array. We used the length p to find each of elements we need. We also have to add the ‘.’ back in, since the array didn’t save the character we split by. Pieced together, we set location to void(0) is a dummy function in JavaScript. It evaluates to 0. By ending our function with void(0), we make sure our bookmarklet doesn’t return anything undefined and report an error. The () at the end says our function had no arguments, and we are executing it now.

Now we are done. The browser takes us to find out that Private owns And you have some idea how a JavaScript bookmarklet works. Actually, I own, but I registered with, and at no additional cost they provide private registrations of domains.

Facebook comments:

Leave a Reply