Im trying to create a script that will grab the users clipboard data on pageload, and show up in a textbox where they can press Submit.
Ive looked all over google and can not find the solution. I was wondering if this is possible?
Im trying to create a script that will grab the users clipboard data on pageload, and show up in a textbox where they can press Submit.
Ive looked all over google and can not find the solution. I was wondering if this is possible?
Afaik it's not possible for security reasons - imagine the case that you just copy-and-pasted some password and a website steals it.
No can do. As previously mentioned, this would be a security nightmare if it was possible!
Reading the clipboard is disabled by default in most browsers (for security reasons). You could try this (jQuery) but it wont work unless the user has clipboard access enabled.
<script type="text/javascript">
$(document).ready(function() {
if(typeof(window.clipboardData)=="undefined") {
alert("clipboard disabled")
}
else {
$('#text_area").val(window.clipboardData.getData());
}
});
<script>