Google's Chrome allows websites to write to the clipboard without the permission of the user. Of course (for those in the know this could be a major security hole.
How you can try it:
- Visit her address https://webplatform.news/ in a Chromium-based browser
-
Check what your clipboard has saved (paste it somewhere)
Το δοκιμάσαμε. Η παραπάνω εικόνα δείχνει την ιστοσελίδα και στη συνέχεια βλέπετε το txt αρχείο που έκανα pasting for essay.
Chrome allows websites to write to the clipboard without the user's permission
The site uses the following JavaScript code to write to the clipboard:
try {
let type = 'text/plain';
let blob = new Blob(
[
'Hello, this message is in your clipboard because you visited the website Web Platform News in a browser that allows websites to write to the clipboard without the user's permission. Sorry for the inconvenience. For more information about this issue, see https://github.com/w3c/clipboard-apis/issues/182.',
],
{ type }
);
let item = new ClipboardItem({ [type]: blob });
navigator.clipboard.write([item]);
} catch (err) {}
There is also the message:
Hello, this message is in your clipboard because you visited the Web Platform News site in a browser that allows sites to write to the clipboard without the user's permission. Sorry for the inconvenience. For more information about this issue, see github.com/w3c/clipboard-apis/issues/182.
The specific problem is described on GitHub. The webpage can write to the clipboard with the Chrome browser using navigator.clipboard.write() or navigator.clipboard.writeText() without the user noticing.
Github says that both Safari and Firefox don't respond to the page's JavaScript.
We should mention that this particular problem also occurs in Edge or other Chromium clones.