I'm using the the following code to generate TinyMCE:

<script type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
        tinyMCE.init({
            mode : "textareas",
            theme : "advanced",
            plugins : "...",
            theme_advanced_buttons1 : "...",
            theme_advanced_buttons2 : "...",
            theme_advanced_buttons3 : "",
            theme_advanced_toolbar_location : "top",
            theme_advanced_toolbar_align : "left",
            theme_advanced_statusbar_location : "bottom",
            theme_advanced_resizing : true
        });
</script>

(Removed the options in buttons and plugins for clarity)

My page is generated dynamically via PHP, and the script shown above is included in that. The resulting output is tidied with PHP's htmltidy lib, generating a valid XHTML page.

However, the page occasionally gets incorrectly rendered, this seems to be at random. One example is the following code (shown when I view source in Safari):

<li class="navLink">
    <a href="http://myaddress/index.php?action=sites">Site Management</a>
</li>

But when I inspect this link in Safari, I see that the language include for TinyMCE is being included half way in the href attribute of the link. The HTML being included inside the href is as follows:

<script type=" text="" javascript"="" src="http://myaddress/tiny_mce/themes/advanced/langs/en.js">

This happens randomly, with no pattern that I can discern. Refreshing usually clears the problem up. I have verified this problem happens in other browsers (FF, IE, Chrome).

Unfortunately, the website this is occuring on in is currently in development, and cannot be shown to the general public (Sorry about that).

I've tried manually including the language file, in case TinyMCE doesn't load it if it's already declared. No dice.

So, in short: It seems that TinyMCE is including it's language file dynamically, which is occasionally throwing my page out of whack. How can I fix this?

1 answer

1
point

I believe I have fixed this issue by using the jQuery version of TinyMCE instead of the normal JS one.

Answered almost 8 years ago by EvilChookie
  • Great answer because i didn't know they had a "jQuery" version Darryl Hein almost 8 years ago