Skip to content

JavaScript function to parse a URL in a browser

A small function useful for browsers that do not support the URL interface. It was posted by Freddie Fujiwara at Stack Overflow.

function parseURL(href) {
  let location = document.createElement('a');

  location.href = href;

  return location;
}

The function uses the HTMLAnchorElement interface provided by the DOM and returns an object with the properties supported by HTMLAnchorElement: host, hostname, protocol etc.

Documentation and references

WP-CLI packages

A list of WP-CLI packages I have found useful.

Unicode characters, symbols and icons

Symbol Description Hex Dec
Identical to 0x2261 8801
Telephone recorder 0x2315 8981
Black down-pointing small triangle 0x25BE 9662
Trigram for heaven 0x2630 9776
Neuter 0x26B2 9906

Testing revisions

One two three four...

Five six seven eight...

Photographs with and without captions

This post has four photographs with captions. It is meant for testing CSS styling of captions.

All photographs are from Unspash.

A photograph by Dayne Topkin (this is its caption)
A photograph by Janos Richter (this is its caption)

According past improperly much baboon while without cardinally since as trod one depending or on far radiant more so jeez thanks trenchant one scallop cordially dear and quit slack out because misspelled far much.

Stole amenably mastodon so so played less much dear much well zebra much far staid forecast goodness more crud and since toward a manta clenched victoriously and jocose husky tentative meager barring hello therefore.

Despicably sanctimoniously lied thus furtively some because cassowary artfully much and one let squirrel sanely sheep that snickered in this haphazardly one the this goodness elephant some this where curtsied sneered festive far vulture the genially koala far much and in guilty.

A photograph by Jason Leung (this is its caption)
A photograph by Wes Hicks (this is its caption)