public marks

PUBLIC MARKS from decembre with tags url & javascript

13 June 2018

URL - BOOKMARKLET - Up! - » Bookmarklets by Ben Alman

Up! is similar to the Google Toolbar’s “Up a Level” button, but works in a more “micro” scope. First any #anchor is removed, then any ?querystring, then any filename, then any folders (one at a time). After that, hostnames are removed, and when nothing else is left to remove, www. is prepended to the domain, for good measure! Here is a simple illustration of how a URL would change through iterations:

08 June 2018

JAVASCRIPT - URL - Javascript: document.url without the anchor (hash) portion - Stack Overflow

Specifying the first element worked for me: window.location=document.location.href.match(/(^[^#]*)/)[0]