Copy as HTML Link for Firefox

Here’s the scenario

Firefox LogoYou’re blogging. WordPress, Movable Type, Blogger, it doesn’t matter. You’ve got like 15 to 20 tabs open in Firefox. As per usual.

You’ve just stumbled upon the best quote on some blog that’s like totally supportive of whatever you’re blogging about. So you copy the URL and flip back to your post, only to experience this unsettling cognitive race condition.

Since you’ve yet to copy the actual text of the quote into your post, Blog platform link buttonsyou can’t use your blog’s “create a link” button (some popular examples to the right). But at the same time, you can’t go back and copy the text without losing the URL. Errr.

Have you heard the one about the farmer trying to get a wolf, a sheep, and a cabbage across the river?

So what happens?

As a workaround, you paste the URL into your post, flip back to the post you got the URL from, copy the text you meant to excerpt, flip back to your blog (trying to find the right tab), paste the text, cut the URL out of your post, select the copied text, click the “create a link” button, and finally paste the URL into the JavaScript popup where you’d originally intended.

All that for a link! Two words: usability nightmare.

Even if things had happened in the right order—select text, copy text, switch tabs, paste text, switch tabs, copy URL, switch tabs, select text, click “create a link” button, paste URL—copying a simple quote and its URL from a webpage still requires 10 tedious, error-prone, and redundant steps.

So what should happen?

I want to be able to copy a quote and its URL at the same time, without having to so much as think about it. To do so, I wrote my first Firefox extension, which I opted to name the somewhat homely, Copy as HTML Link.

I took Jeremy Gillick’s Copy Plain Text plugin and modified it (with permission) to build an HTML link out of whatever text is selected, containing both the text and its URL. The idea was so simple, I can’t believe I didn’t think of it earlier. I also looked at Jedrick Kostecki’s excellent imgTag extension for inspiration, which does the same for <img /> tags when you right click on an image.

So if you were to use Copy as HTML Link to copy the first line of this paragraph, and then you pasted that into your blog post or text editor, you’d get:

<a href="http://justinsomnia.org/2006/05/copy-as-html-link-for-firefox/">I want to be able to copy a quote and its URL at the same time</a>

How to use Copy as HTML Link

Here’s a visual explanation of how it works:

Copy as HTML Link screenshot and instructions

What was 10 steps becomes 4: Select text, right click and select Copy as HTML Link, switch tabs, paste link.

Bonus step 5: continue blogging, train of thought intact.

Get Copy as HTML Link for Firefox

Update: you can now download this extension from addons.mozilla.org: Get Copy as HTML Link.

if you’d like to install the extension directly from me, feel free to install Copy as HTML Link by clicking this link (updated for Firefox 2.0 3.0!). The first time you click that link, you’ll have to manually allow extension installations from justinsomnia.org by clicking “Edit Options” in the upper right, clicking “Allow”, and then clicking the install link again. After it installs, just restart Firefox and you’ll be good to go.

Update: Brian Layman has created a version of Copy as HTML Link and imgTag for Internet Explorer. Excellent.

relatedposts

39 comments

name
blog (optional)
comment

Absolutely Brilliant! Thank you!

How about Copy IMAGE as Link?

Brian, actually it already exists.

In my search for an extension that created links like this one, I found imgTag which does similar for <img /> tags when you right click on an image.

[…] So he created Copy as HTML Link for Firefox and generously shared his moment with wp-hackers Subscribers . It looks good and he did a good job documenting it: […]

[…] Die Firefox-Extension Copy as HTML-Link erlaubt das einfgen kopierter Links mitsamt dem dazugehrigen a-Tag und Linktext. Das spart enorm Zeit. Mal wieder eine wirklich brauchbare Erweiterung. (via Pixelgraphix) […]

[…] Ein einfacheres und schnelleres Bloggen ermöglicht nun die Firefox-Erweiterung “Copy as HTML Link”, die über den Beitrag des Autors unter justinsomnia.org installiert werden kann. […]

[…] (English Version below) In ihrem Artikel Speed-Blogging mit Copy as HTML schwärmem Evy & Stefan Evertz: Ein einfacheres und schnelleres Bloggen ermöglicht nun die Firefox-Erweiterung “Copy as HTML Link”, die über den Beitrag des Autors unter justinsomnia.org installiert werden kann. Während ich bisher den zu zitierenden Text markieren und kopieren musste, ihn dann in meinen Beitrag kopieren musste, um dann wieder zum zitierten Beitrag zu wechseln, um dort die Adresse in die Zwischenablage zu kopieren, reicht nun ein Klick, um den Text inklusive Link in die Zwischenablage zu bekommen […]

[…] As I told you yesterday, there are a few things waiting to show up on this blog - and I told you it was an ordinary school day today. I actually wasn’t at school today because I contracted an illness. Fortunately it isn’t that bad so I’ll likely go to schol tomorrow again. To come to the really interesting topics for you: For every blogger and Firefoxuser, there are two extensions I recently found to be practical. Number one is Copy as HTML Link, which creates a HTML link to a site with the text you higlighted on the site and copies it to the clipboard. Now there’s no more fiddling around with a href, just paste the code from the clipboard and you’re done. The second one is only slightly different: Jedrick Kostecki’s imgTag extension does the same job for images. […]

[…] Copy as HTML Link for Firefox - Justinsomnia (tags: firefox extension) […]

[…] gutes Plugin für Firefox, Copy as HTML Link: Webseiten-Text markieren, kopieren und einfügen. Dabei werden auch die HTML-Links mitgenommen. Super praktisch beim Bloggen. Mit ein Grund, warum ich damals das Performancing Blog-Plugin genutzt hatte, das geht sogar mit Drag&Drop in die untere Fensterhälfte vom Firefox-Browser. […]

[…] Copy as HTML Link for Firefox ist eine  super Extension, die den Link aus der Eingabgezeile mit einem beliebigen Text der jeweiligen Seit in die Zwischenablage legt. […]

[…] Die Firefox-Erweiterung Copy as HTML Link for Firefox spart viel Zeit beim Bloggen! Das Kopieren einer URL per Rechtsklick mit dem anschließenden Aufwand den Link-Tag zu schreiben entfällt mit dieser Erweiterung, da der fertige Tag eines markierten Links in die Zwischenablage kopiert wird. Zu ergänzen wäre dann z.B. nur noch eine target Angabe. Super Extension! […]

[…] Endlich ist sie da, die Firefox-Erweiterung, auf die ich gewartet habe: Copy as HTML Link for Firefox. Bisher habe ich zum Bloggen genau aus diesem Grunde Safari verwendet, denn »Copy as HTML« bringt eine beträchtliche Zeitersparnis mit sich. Statt eine URL per Rechtsklick zu kopieren und dann einen Link-Tag zusammenzusetzen, erhält man nun auch in Firefox per Rechtsklick den kompletten Link-Tag zur Weiterverarbeitung. Wow und Danke! […]

[…] Last but not least: Copy html Link ist fuer Safari Benutzer nichts Neues, fuer Andere aber schon. So lassen sich naemlich mittels Rechtsklick Texte markieren und direkt als html Link woanders einfuegen. […]

[…] Talking of Firefox extensions, wouldn’t it be useful if there was one that allowed me to copy a quote and its URL at the same time, without having to so much as think about it? Well, now there is, and I just used it to link to Justin, who wrote the extension. […]

Great, brilliant, effective.
Thanks Justin.

Would it be easy to modify this ext. to format for pasting to a vbulletin url format?

[URL="http://......"]Copied Text[/URL]

[…] I don’t think I need to extoll the virtues of Firefox here, but it sure does have good extensions, which would make a post in of themselves. I’ll confine myself to the latest one I’ve nabbed: the copy as html link firefox extension which is a boon to bloggers everywhere (along with Google Notebook) in cutting and pasting links (how often have you copied the address, come back here, pasted it, gone back, copied the title, back here, paste, and so on ad infinitum?). With this, you highlight the text you want, right click, choose the copy as html that is now present, and go back to paste in one step. This is one of those tiny little utilities that fix something truly headdesking and yet never addressed till now and you wonder why it doesn’t do it this way to begin with. This is functionality that should be built into browsers. […]

Wow. Once again, you are my hero, Justin. Thanks and rock on…

Thanks for the mad props Ruby! (You catching up on old blog posts?)

[…] Copy as HTML Link for Firefox (via Pixelgraphix) Erweiterungen, Firefox « links for 2006-05-27 links for 2006-05-28 » Tags / Verwandte Artikel: […]

Maybe you can also make it as BBCode, its usefall as the html link. Thank you very much, nice work.

As a person that is new to blogging. This is a really simple but extremely useful tool. Great job!

i love you. you made exactly what i needed. you’re my hero! lol.

jason, you’re very welcome.

add target=”_blank” ?????

pheonix, I tried to keep this extension as simple and general as possible, without lots of configurable options. If I’d adding the ability to do target="_blank", someone else would want title="blah". So rather I opted for a minimal anchor tag that you can then manually add additional attributes to as you like. You can also download the plugin and modify the source to your liking.

Love the extension by the way
Thanks

i need help…i want to make a link that leads to 15 addresses

meko, I’m not sure I understand what you’re asking. This plugin generates a link to the page you are viewing based on the text you have selected at the time you right-click, e.g.

<a href="http://page-you-are-viewing.com">text you have selected</a>

What about copying links from Google search results?

fateh, that’s a little more difficult, since Google often obscures the link to send it through a redirector in order to count which results you click on. The best option would be to open the result page in another tab and use Copy as HTML Link from there.

Great Extension !

How can I copy multiple links from a page as HTML?

bo, since the link you’re “copying” is the link to the page you’re currently on (not a link on that page to another page), it doesn’t make sense to copy multiple links. there is only one possible link.

Oooooh thank you so much … this wudda saved me hundreds of hours in the past years.

Justin,

That’s a lovely extension. I came across it while looking though for something slightly different. Perhaps you’ll find it interesting enough to incorporate in a future release of this extension. The idea is that you may already have a text in your textarea, and you want to put a link on top of it. So I’d like to have an extension that, upon a paste command inside a textarea with a selection present, provided that clipboard contains a URL, will make the selection into a link to the URL in question. What do you think?

I would love if you can make a feature for copying mutliple links and include the link text and location.

For example, I want to copy a list of links from one webpage, and I want to paste those link locations along with the text into a list. I would like it to auto generate the html code for the mutliple links, locations and text. This would be the biggest help EVER. Can you do it?

Any chance of an update so it will work with Firefox 3.

Hey all, I’ve tested on Firefox 3.0b4, and it worked like a charm, so I’ve bumped the version number as high as they’d let me on addons.mozilla.org and I’ve bumped it all the way to 3.0 if you care to download directly from here. Since I didn’t change any code or functionality, I’ve left the version number 1.1.