Click here to Skip to main content
15,606,569 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a iframe which is used as rich text box editor means entered text can be bold/italic/underline.

if user paste data in this frame I just want to put some restriction on that data before pasted. like if user tried to paste some script or some restricted XSS content just restrict them.

The solution should work for chrome and edge browser.


What I have tried:

I have tried below code-

var text=e.clipboardData.getData('text/plain')
// put validtion
// then prevent to paste
// show error message to user
Updated 20-Sep-22 1:23am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900