Is there a way to just copy the relative URL rather than absolute on right click?
I'm trying to see if there is a way to add a function to the right click in firefox to copy only the relative URL path rather than the entire thing when trying to copy URLs. I have to do a lot of URL copying and I don't want the full domain in there, just the relative path in case the domain changes, so I want to be able to copy them faster than having to select after the domain every time. Any ideas?
All Replies (11)
Do you mean when you right-click a link in a page, to get part of that link, or when you right-click (somewhere) to copy the address of the current page?
Unfortunately, I can't think of any built-in feature for either of those.
Add-ons (extensions) could add an item to the right-click context menu for the web content area to copy a partial URL to the clipboard. Similarly, they could grab part of the current page URL when you click a toolbar button. That would be the smoothest solution for you, if you can find an add-on like that in a search or through a user recommendation:
https://addons.mozilla.org/firefox/extensions/
Otherwise... it might be possible to put something together without an extension, but it would have extra steps.
Either a link in a page or in the address bar. Do you know of any extension that does this or something that adds it to the right click menu?
If I knew of an extension, I would have mentioned it already. One of us has to search for it, and I'd like to leave that to you. ;-)
found something similar to it but not in the right click menu so doesnt help much
Edeziri
CyrezEraser said
I'm trying to see if there is a way to add a function to the right click in firefox to copy only the relative URL path rather than the entire thing when trying to copy URLs. I have to do a lot of URL copying and I don't want the full domain in there, just the relative path in case the domain changes, so I want to be able to copy them faster than having to select after the domain every time. Any ideas?
You first need to give a example of what your doing so others can replicate the question to know exactly how your going about it.
So I would be going to a page like this:
https://www.costumesupercenter.com/categories/new-arrivals
I just want to copy the /categories/new-arrivals and not anything before the /
Right now I have to keep selecting the relative URL after the /, so I want to use something that will just copy the relative URL immediately without having to select it manually.
Note that this would be: document.location.pathname+document.location.hash
Possible bookmarklet for pages that do not block JavaScript via CSP:
javascript:void(prompt('URL:\n'+document.location.href,document.location.pathname+document.location.hash));
Thanks this could work if I can figure out how to trigger bookmarks in the toolbar with a keyboard shortcut.
and this will work for pages in the address bar but what about links copied from the webpage itself? Would be cool if you can do it in the right click menu as well for copying those links
An extension called CopyExtraURL copies the address bar relative URL as well but doesn't have a keyboard shortcut either. Can't find a way to contact the author either
CyrezEraser said
An extension called CopyExtraURL copies the address bar relative URL as well but doesn't have a keyboard shortcut either. Can't find a way to contact the author either
Yes, the author seems a bit shy about providing contact information. The JavaScript file in the extension has
Author: Alexey Martynenko
But which one? Hmm... hopefully you'll hear through the review.