问题
When I copy a section of test from this website
my clipboard gets extra text appended to the end of it saying "Read more: " then the url of the page I was reading (plus a unique looking string on the end)
How have they done this?
回答1:
I've made some reverse engineering and it looks like this script is responsible for clipboard manipulation:
http://tcr.tynt.com/ti.js (use http://jsbeautifier.org/ to see uncompressed code)
See the introduction movie on this website:
http://www.tynt.com/
Technically I don't know how is it done, looks like they don't use Flash but make use of getSelection() function and copy, contextmenu events.
回答2:
When your select text on their page (before the Copy happens) a zero-height div containing the extra text ("Read more: .....") is created off the page (position: absolute; top: -1000px
) and that text is then added to the selection.
So when you copy your selected text, you are also copying the text that is hidden off the page.
来源:https://stackoverflow.com/questions/8820445/javascript-clipboard-manipulation-after-section-has-been-copied-from-website