url / Intro / Intro


The parser provides some syntax sugar for parsing url's.

Sponsor Me

If you like this project, please consider sponsoring.


The plugin supports various formats for usage.


var url  = require('url');

console.log(url('hostname', 'https://websanova.com')); // websanova.com


<script src="/url/dist/jquery-url.min.js"></script>

    console.log($.url('hostname')); // websanova.com


<script src="/url/dist/url.min.js"></script>

    console.log(window.url('hostname')); // websanova.com

TLD Version

There are two versions, url.min.js and url-tld.min.jd. The tld version contains a list of valid tld's making the file about 2kb larger. Alternatively the domain parts can be sniffed directly using arguments such as url('-1') to get the tld pieces needed.

NOTE: The tld list is just for "common" tld's and does not include a full list which is quite extensive.