/    Sign up×
Community /Pin to ProfileBookmark

Access clipboard data through javascript in firefox

Hi,

I required a code so that i can access clipboard data through javascript in firefox

Try the code given below

[CODE]<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<title>Untitled Document</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<script type=”text/javascript” language=”javascript”>

function Paste()
{

var objDoc=document.createElement(“TextArea”);
objDoc.value=window.clipboardData.getData(“Text”);

window.clipboardData.setData(“Text”,objDoc.value);
objDoc=null;

}

</script>

</head>

<body>
<div onpaste=”Paste()” style=” height:200px; width:200px” id=”divLive” contentEditable>
ererrertwerwertewtweterererereerterert
erterte
ertert
ert
ewrterertew
wertwer
retewrewr
reertert
trert
wer
erer
</div>

</body>
</html>[/CODE]

save the above code in an html file and run it in IE it will work fine and you can paste any thing from word into the given div but the same code did not work in firefox

please help me to sort out this issue

to post a comment
JavaScript

1 Comments(s)

×

Success!

Help @rupngr spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...