-
September 3rd, 2010, 04:13 AM
#1
Strip all javascript from HTML
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?
-
September 3rd, 2010, 02:31 PM
#2
Re: Strip all javascript from HTML
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:..."
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|