Discuss various technical topics not related to Mozilla.
santhosha
Posts: 3Joined: December 21st, 2018, 5:48 am
Posted December 21st, 2018, 5:56 am
Hello,
can you please suggest me how to enable window.clipboard in unsecured web pages, currently i have a project where i need to copy selected text and paste it in somewhere. So am using document.execCommand("copy"); but am not able to find window.clipboard in developer tool. So not able to copy the things to clipboard. Or suggest how can I enable it using javascript.
DanRaisch
Moderator

Posts: 122238Joined: September 23rd, 2004, 8:57 pmLocation: Somewhere on the right coast
Posted December 21st, 2018, 6:02 am
Moving to MozillaZine Tech as this is not a Firefox issue.
santhosha
Posts: 3Joined: December 21st, 2018, 5:48 am
Posted December 21st, 2018, 6:05 am
where should i post? @DanRaisch
DanRaisch
Moderator

Posts: 122238Joined: September 23rd, 2004, 8:57 pmLocation: Somewhere on the right coast
Posted December 21st, 2018, 6:07 am
You don't need to do anything as I've already moved your post to the more appropriate location.
santhosha
Posts: 3Joined: December 21st, 2018, 5:48 am
Posted December 21st, 2018, 6:08 am
Ok, Thnak you @DanRaisch, tell me Where can i get the update?
DanRaisch
Moderator

Posts: 122238Joined: September 23rd, 2004, 8:57 pmLocation: Somewhere on the right coast
Posted December 21st, 2018, 7:26 am
You're welcome. To what update are you referring?
mightyglydd

Posts: 9599Joined: November 4th, 2006, 7:07 pmLocation: Hollywood Ca.
Posted December 21st, 2018, 8:23 am
morat
Posts: 3490Joined: February 3rd, 2009, 6:29 pm
Posted December 21st, 2018, 2:43 pm
Are you using the clipboard code with a click handler? I tried the following code in the error console. - Code: Select all
function readFromClipboard() { var element = document.createElement("textarea"); document.body.appendChild(element); element.focus(); element.select(); document.execCommand("paste", false, null); element.remove(); return element.value; } function writeToClipboard(text) { var element = document.createElement("textarea"); document.body.appendChild(element); element.value = text; element.focus(); element.select(); document.execCommand("copy", false, null); element.remove(); } writeToClipboard("abracadabra");
It works in Chrome, but not in Firefox. document.execCommand(‘cut’/‘copy’) was denied because it was not called from inside a short running user-generated event handler
More info http://stackoverflow.com/questions/41094318
Return to MozillaZine Tech
Who is online
Users browsing this forum: No registered users and 5 guests
|