I've seen some questions on catching the paste event. This looks helpful. But I want to prevent paste on a designmode iframe from happening when the pasted content is not plaintext, but comes from MS Word or other WYSIWYG editor.
What is Your experience on that?
I suppose I should catch the event (bind to iframe or to its body?) and look for some specific tags in th开发者_如何学编程e clipboard. What content does Ms Word add every time?
[edit] After doing more research I see there is no easy way to work with clipboard in non Internet Explorer browser except some Flash tricks. I don't want them. How can I detect paste in Firefox and others then?
Read This Too!
JavaScript get clipboard data on paste event (Cross browser)
And also this:
http://www.quirksmode.org/dom/events/cutcopypaste.html
Then i think, you need to go with flash object + javascript! ;-)
this is the one i have used in my project!
UPDATE:
keep in mind, that << Just because another browser allows you to do copy/past doesn't mean it's "good", "safe" or "right." >>
Firefox it's not buggy, it's just need to grant your page permission to access the clipboard!
http://www.infogears.com/cgi-bin/infogears/mozilla_firefox_copy_paste.html
http://www.mozilla.org/projects/security/components/per-file.html
https://developer.mozilla.org/en/Using_the_Clipboard
You are probably better off catching the paste event and then cleaning the pasted content to only contain valid HTML. It will be some fun regular expressions but I am sure you can find some one who has already written some of them online.
精彩评论