By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,153 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

Getting the clipboard content from Notepad to the html page

P: 1
Hi
How can I get the clipboard content from Notepad to my page ?(For pasting I use the dhtml method document.execCommand('Paste', true, null) and it works fine - but I need the clipboard content without calling "Paste" option).
Thanks,
Zana
Oct 5 '05 #1
Share this Question
Share on Google+
3 Replies


acoder
Expert Mod 15k+
P: 16,027
If it works (though probably only in IE), not sure why you'd want an alternative.
Apr 5 '08 #2

rnd me
Expert 100+
P: 427
the firefox version is a lot longer, and requires a user-change to about.config, let me know if you want it.


Expand|Select|Wrap|Line Numbers
  1.  
  2. function CB() //sets or read clipboard in IE accepts 1 arg to set, returns cb when no argument is passed
  3. {
  4. if (arguments.length)     {window.clipboardData.setData('Text', arguments[0])}
  5. else     { return window.clipboardData.getData('Text')}
  6.  }//end CB
  7.  
  8.  
Apr 6 '08 #3

acoder
Expert Mod 15k+
P: 16,027
True, Firefox does have that option and that's the way it should be - up to the user if they want to allow JavaScript access to the clipboard. You could always inform your users how to enable it and then the choice is theirs.
Apr 7 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.