Copy specific part of a browser URL Bar

I’m trying to figure out a way to copy only a specific part from the URL Bar, any assistance is appreciated!

The link goes something like

https://internal.dummysite.com/compliance/accounts/ACCOUNTNAME/#photos

I want the command to copy the /ACCOUNTNAME/ bit from the link. |

Tried something like:

var el = document.createElement('a');
el.href = "https://internal.DUMMYSITE.com/compliance/account/ACCOUNTNAME/#photos";

el.host        // www.internal.DUMMYSITE.com
el.hostname    // www.DUMMYSITE.com
el.hash        // #photos
el.href        // https://internal.DUMMYSITE.com/compliance/account/search?filter=a/#photos
el.pathname    // /show/search
el.protocol    // http:
el.search      // ?filter=a

Now I’ll have you know that I’m a complete beginner so please don’t murder me on the comments, all help is appreciated and massive thanks in advance for anyone willing to assist.

Cheers!

82 thoughts on “Copy specific part of a browser URL Bar”

Leave a Comment