Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Chrome escapes WYSIWYG Javascript

So my problem is relatively simple, I've Googled all over to find a solution but I've yet to find one.

The problem is, I've developed a WYSIWYG plugin for Drupal's WYSIWYG module/framework (not sure if this is relevant). The purpose of the plugin is to allow embedding of video files inside the WYSIWYG content. Our client offers a video uploading/editing API which their customers use to embed files on their pages.

To put it simply, my plugin opens up a pop-up where the user selects one of their videos as fetched from their account at the clients site, the plugin then calls the API and is returned with HTML and JavaScript for embedding the video which is then inserted into the WYSIWYG content.

This works like a charm in Firefox, however I have a few problems with it in Chrome. After debugging back and forth I've noticed that the embedded JavaScript inside the WYSIWYG editor gets escaped (IE, quotes turned into &quot etc).

This does not happen with Firefox so it's most likely Chrome which is causing it, or perhaps even Webkit? I've already checked the HTML and JavaScript that gets returned through the Ajax call and it is fine, it's when it gets embedded inside the WYSIWYG it gets escaped.

The WYSIWYG editor I've tested in is TinyMCE by the way.

like image 873
tobbr Avatar asked May 18 '11 12:05

tobbr


1 Answers

Adding as an answer for @tobbr to help other SO users:

i solved this by adding the script to a db table instead and then loading it using drupal_add_js with hook_nodeapi. works better and solves another IE related problem

like image 80
diagonalbatman Avatar answered Sep 21 '22 00:09

diagonalbatman