How to append text to a JTextArea?

How does HuffPo append URLs to copied text?

  • I noticed today that text copied from articles on The Huffington Post appends the article URL when pasted and I'm wondering how it's done. Here's an example of copying and pasting text from the current front page story of the G20 meeting: The three leaders, in their dramatic joint statement that overshadowed the G-20 economic summit here, hoped the disclosure would increase pressure on the global community to impose new sanctions on Iran if it refuses to stop its nuclear program. Read more at: http://www.huffingtonpost.com/2009/09/25/obama-iran-has-secret-nuc_n_299556.html The "Read more at:..." portion never appeared on the page. Repro steps: 1) Copy any random paragraph from a HuffPo story. 2) Paste elsewhere. I'm using FireFox 3.5.3 on Windows 7. I don't see this behavior when copying from other sites.

  • Answer:

eyeballkid at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

They include a link to a script file:<script type="text/javascript" src=http://www.huffingtonpost.com/include/lib/copy_paste.js?v=1.02></script>Which captures your "copy", and adds that text.

blue_beetle

Check out http://tracer.tynt.com/ for more information.

Johnny Assay

Just a reference point for you: In OS X, dragging the text to the desktop (in OS X this is a textclipping file) doesn't reproduce the javascript tag, but copying to "compose email" in gmail does.

sharkfu

Thanks. I just found the script after missing it the first time through the source. I didn't realize that javascript could be used to modify your copy.

eyeballkid

That's messed up. For what it's worth, the Copy As Plain Text add on for Firefox clears that out, as you would expect.

CunningLinguist

It is messed up, I was surprised by it when I IM'ed a paragraph from a different story this morning and had to edit it out. Thanks for the Copy as Plain Text suggestion.

eyeballkid

Whatever they're trying to do with that script, it does not work with firefox 2.0 on linux, as I don't see anything appended when I paste.

Rhomboid

Nor does it work in Safari on Snow Leopard.

impluvium

Things like this are why I love-love-love http://www.stevemiller.net/puretext/!

sprocket87

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.