Websites that cannot “copy and paste” the selected part as it is, and how does it work?



“Copy and paste,” which saves document files and website contents to the clipboard and pastes them elsewhere, is now a common practice today when PCs and smartphones have become widespread. Copy and paste is specified by dragging the range to be copied with a mouse or the like, but engineer

Alex Ellis points out that there are websites that can not be copied and pasted as specified.

Don't touch my clipboardCaffeinspiration
https://alexanderell.is/posts/taking-over-my-clipboard/

Alex went to the The Punctuation Guide website to copy and paste the em dash, and tried to copy and paste the contents.

Em dash | The Punctuation Guide
https://www.thepunctuationguide.com/em-dash.html



Then, he noticed that the copyright of the site was added in addition to the content selected by Alex.



Alex, who noticed the incident, checked the HTML on the website and found a JavaScript file named 'copyright.js'.



Looking at the contents of 'copyright.js', 15 lines of code were described except for comments and blank lines, and a function called 'addLink' was defined. When observing the flow of the addLink function, an operation was performed in which an element was created by combining the range specified by the user and the copyright, and the original selection was replaced with that element.



The behavior of 'copyright.js' can also be determined from the appearance of the website. Select website text ...



Click “Copy”.



Then the selection highlighted in yellow disappeared. This means that the elements in the selection have been replaced by other elements.



Alex says, 'It's important to clarify the attribution of website content, but these behaviors do not respect user behavior.' Also, when copying and pasting symbols like '-', he is interested in whether copyright is effective.

It is pointed out that 'copyright.js' used on this website is a copy and paste of the code posted on

Stack Overflow as it is.

How to add extra info to copied web text-stack overflow-stack overflow
https://stackoverflow.com/questions/2026335/how-to-add-extra-info-to-copied-web-text?rq=1

in Note,   Web Application, Posted by darkhorse_log