New issue
Advanced search Search tips

Issue 690859 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Feb 2017
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

clipboardData.getData is broken completely and useless

Reported by labobol...@gmail.com, Feb 10 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

Steps to reproduce the problem:
1. Run the code below in on any site with text.
2. Copy some text.
3. Look at the console.

What is the expected behavior?
clipboardData.getData('text') should return text

What went wrong?
clipboardData.getData('text') returns nothing

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 56.0.2924.87  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 24.0 r0

Test code, run it on any site with text:
document.addEventListener('copy', function (e) {
        console.log(e.clipboardData.getData('string'));
        console.log(e.clipboardData.getData('text'));
        console.log(e.clipboardData.getData('text/plain'));

        console.log(e.clipboardData.getData('text/html'));
        console.log(e.clipboardData.getData('url'));
        console.log(e.clipboardData.getData('text/uri-list'));
        var items = e.clipboardData.items;
        if (items) {
            for (var i = 0; i < items.length; i++) {
                console.log(items[i].type, items[i]);
            }
        }
});

I want to format the selected text on a site that isn't copy-text-friendly, I've had it with manually fixing the text afterwards in my text editor. Disappointingly but expected, nothing works in Chrome.

 

Comment 1 by sigbjo...@opera.com, Feb 10 2017

That's expected, you don't have read access to the contents of the clipboard during 'copy' -- https://developer.mozilla.org/en-US/docs/Web/Events/copy

Comment 2 by sigbjo...@opera.com, Feb 10 2017

Status: WontFix (was: Unconfirmed)

Sign in to add a comment