为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Is there a way to just copy the relative URL rather than absolute on right click?

more options

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?

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?

所有回复 (11)

more options

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.

more options

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?

more options

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. ;-)

more options

found something similar to it but not in the right click menu so doesnt help much

由CyrezEraser于修改

more options

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.

more options

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.

more options

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));
more options

Thanks this could work if I can figure out how to trigger bookmarks in the toolbar with a keyboard shortcut.

more options

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

more options

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

more options

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.