Use a good script stripping method to clean the inserted html to avoid mailicious script injection. http://stackoverflow.com/questions/6659351/removing-all-script-tags-from-html-with-js-regular-expression and https://github.com/LiftoffSoftware/htmltag/blob/master/htmltag.py#L186 could be a start.