Call a clipboard access prompt in IE 11 with JS after user has refused it

142 views Asked by At

When a user has refused a clipboard access prompt, the message is not showing while next copy attempts, until the page will be reloaded. Is there a way to call the prompt manually without the page reload?

I am using React with copy-to-clipboard 3.3.1 npm package. According to the Niet the Dark Absol's advice, my copy function looks like

copyToClipboard(phone: string) {
    copy(phone, {
        format: 'text/plain',
        onCopy: (clipboardData: DataTransfer) => {
            const copiedPhone = clipboardData.getData('text/plain');
            if (copiedPhone === phone) {
                this.setState({showMessage: true});
            }
        }
    });
}

Means that I show 'Success' message when text was copied

0

There are 0 answers