With this class we just need to pass the URL and we can get different part of that URL, like host, port, directory, query string, etc.
We will check this with below test URL:
Test URL: http://user:email@example.com:8383/the/path.html?query=value#anchor
var my_uri_obj = new URI(url);
my_uri_obj.get('scheme'); //returns "http",
my_uri_obj.get('user'); //returns "user",
my_uri_obj.get('password'); //returns "password",
my_uri_obj.get('host'); //returns "www.test.com",
my_uri_obj.get('port'); //returns "8383"
my_uri_obj.get('directory'); //returns "/the/"
my_uri_obj.get('file'); //returns "path.html"
my_uri_obj.get('query'); //returns "query=value"
my_uri_obj.get('fragment'); //returns "anchor"
So this is how you can get the different part of the URL using MooTools More Class(URL). This helps me to solve my problem, I hope this will helps you in same way. Best Luck :)