Does anyone happen to have a PHP script that can strip all javascript from HTML leaving the HTML tags, but removing the attributes for scripted events and script tags?
Printable View
Does anyone happen to have a PHP script that can strip all javascript from HTML leaving the HTML tags, but removing the attributes for scripted events and script tags?
1. Create an array of all JavaScript events (onclick, onkeypress, etc.).
2. Use preg_replace() to remove all contents inside.
3. Use preg_replace() to remove all <script> tags.
4. Use preg_replace() to remove all instances of "javascript:..."