How to parse URL using jQuery
by Dhanck
HTML
<span></span>
CSS
span {
font-family:calibri;
font-size:12pt;
}
JavaScript
$(document).ready(function () {
var url = 'https://www.matchesfashion.com/womens/shop';
//Create a new link with the url as its href:
var a = $('<a>', {
href: url
});
var sResult = '<b>Protocol:</b> ' + a.prop('protocol') + '<br/>' + '<b>Host name: </b>' + a.prop('hostname') + '<br/>'
+ '<b>Path: </b>' + a.prop('pathname') + '<br/>'
+ '<b>Query: </b>' + a.prop('search') + '</br>'
+ '<b>Hash: </b>' + a.prop('hash');
$('span').html(sResult);
});