Is it possible to write your own message into the clipboard when copying website data using ctrl+c? I\'ve found some Javascript that clears the clipboard - would be interest
Yes, you can. The basic trick is that you detect when a user holds down Control, and select a different piece of text on the page.
You could place the following:
$( document ).ready(function() {
if (event.ctrlKey && event.keyCode == 67) {
var inputFieldClear = document.createElement("input");
inputFieldClear.setAttribute("value", "Insert Default Value Here");
document.body.appendChild(inputFieldClear);
inputFieldClear.select();
document.execCommand('copy');
inputFieldClear.remove();
console.log("Attempting to Alter Clipboard")
}});
That would work in something like TamperMonkey - not sure if it could be incorporated into the sites source or not.
Hope it helps! :)
You can't do it purely through JavaScript.
JavaScript editing of the clipboard is considered a security vulnerability (and there is much more discussion on this).
You could do it through hacks that uses Flash for clipboard access interacting with JavaScript.