Tuesday, April 1, 2008

TinyMCE and using Rails asset hosts.

Got a weird problem with running the TinyMCE editor from an asset host. It loads ok, but in IE (and IE only: 6 and 7) it fails to load the replaced contents of the textarea form field into its own rich text display. The rich text display is an iframe that it creates on the fly and fills by DOM manipulation.

I am almost certain what's going on that IE's XSS protection is different from FF, Safari, and Opera's and it's preventing the iframe from receiving the data from the javascript served from the asset host.

So I made the javascript tag for that js file only into a fully qualified URL. The rails asset tag won't try to fetch that from the asset host. It works but I don't like it.


Anonymous said...

Can you describe exactly how you did this? I am running into the same problem, but no matter how I put the javascript tag in, mongrel seems to cache it and move it over to assets.

Anonymous said...

To be more specific, when I set config.cache_classes = false
the problem goes away. When it is set to true, the problem comes back. I have cleared out every file I can find with the word cache in it.

p.latyp.us said...

I have to think an awfully long way back! Let me think about it for a few hours and I'll post what I can remember. JJ.

Cory said...

Me again. Just wanted to report to future readers that for some strange reason, the cache for the classes that tell application.html.erb to include tiny_mce would never refresh to what I changed it to. I have yet to figure out how to clear this cache, but I fixed it by having application.html.erb detect to see if tiny_mce is to be included and fix the problem through the HTML file, as the HTML file does not seem to have this same caching problem.