Domain search widget for any website: availability and prices with a few lines of code

API & DocumentationWordPress, Websites & Automation·· 6 views· 2 min read

Want a domain search box on your site? This widget tells whether a name is free or registered, shows the price and free alternatives, and its Register button opens the Interweb registration page. It works on any website, not only WordPress.

What it does

It is plain JavaScript, with no dependencies and no cookies, about 5 KB gzipped. It uses the free WHOIS of the API and needs no key.

What you need

Just a way to add one JavaScript file and two lines of HTML to your site.

Installing, step by step

1 Download the latest release.
2 Copy domain-search.js to your site.
3 Add the two lines just below where you want the box.

<div data-domain-search></div>
<script src="domain-search.js" defer></script>

You can also mount it from JavaScript: DomainSearchWidget.mount(element, { lang: 'en' }).

Options

data-lang: pt or en. Empty follows the browser.

data-extensions: the extensions to check together, up to 10. The first one is used when the name has no extension.

data-currency: the price currency. Empty uses the brand currency.

The API key and its permissions

There is no key. The widget uses the free WHOIS of the API (GET /v1/whois/{domain}). Each visitor can make 60 lookups per hour, and each extension checked counts as one. See the details in the WHOIS documentation.

Testing before you publish

As it uses no key, there is no sandbox_ key to try. Open demo.html, a working page, and adjust the options there.

Good to know

Look: the widget uses the font and text colour of your page. Change the rest with CSS variables on .dsw, such as --dsw-accent, --dsw-border and --dsw-radius. The full list is in the README.

Accessible: screen readers read out the results, the form works with the keyboard alone, and the loading animation stops when the visitor prefers reduced motion.

Privacy: nothing is stored in the browser and no cookies are sent.

Help

If the box does not show or gives no results, open a support ticket and tell us the page address. The code is in the widget repository, under the MIT license.

Ready to add domain search to your site?

Download the latest release

SEE ALSO

WHOIS: what it shows and how to check it

The repository on Interweb Git

SDKs and integrations, in the API documentation

RECOMMENDED PRODUCT

Register your .co.mz domain

Secure your company name before someone else registers it. from 3.751,20 MT/yr

Search a domain
Was this answer helpful? Your answer helps us improve this article.