JSFiddle - React, Tailwind, and code Playground

by Regisc

HTML

<script src="https://raw.github.com/allmarkedup/jQuery-URL-Parser/master/jquery.url.js"></script>
<a id='link' href="../foo/bar/../lol/mypage.aspx">Test link</a><br/>
<input type='button' id='doit' value='Go'/>
<hr/>
<div id="result"></div>

JavaScript

$('#doit').click(function() {
    console.log($('#link').url());
    var url = $.url().attr('source') + $('#link').url().attr('source');
    $('#result').html(url.replace(/(\/[^\/]+\/\.\.\/)+/g, '/'));
});