Skip to content

A small snippet to add your own copy method, in case the original one has been tampered with.

License

Notifications You must be signed in to change notification settings

mayur-kumar1/copy-paste-javascript

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

copy-paste-javascript

A small snippet to add your own copy method, in case the original one has been tampered with.

var frames = document.getElementsByTagName("iframe");
let copyFunction = function(e) {
    if (e.ctrlKey && e.which == 67) {
        var text = this.window.getSelection().toString()
        navigator.clipboard.writeText(text)
    }
}
document.onkeyup = copyFunction
for (let i = 0; i < frames.length; ++i) {
    if (frames[i].id == 'mcas-presence-frame-do-not-remove') {
        frames[i].parentNode.removeChild(frames[i])
    } else {
        frames[i].contentWindow.onkeyup = copyFunction
    }
}
  1. Copy the above snippet.
  2. Open developer tools on the website you want to copy things from.
  3. Paste the snippet into the console and press enter.
  4. Select the text you want to copy and press Ctrl+C.

About

A small snippet to add your own copy method, in case the original one has been tampered with.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%