简体   繁体   中英

TinyMCE not loading

I followed the official installation instructions ( http://www.tinymce.com/wiki.php/installation ) and ended up with the following test code to get TinyMCE running:

<html>
<head>
<title>New Document</title>
<script language="javascript" type="text/javascript" src="tinymce/tinymce.min.js"/>
<script type="text/javascript">
tinymce.init({ 
    selector: "textarea"
 });
</script>
</head>

<body>

<form method="post">
<textarea></textarea>
</form>

</body>
</html>

The problem is that nothing is happening to the textarea. The JS is indeed getting loaded, as I can see in the "network" tab of Chrome console. What am I doing wrong? I have version 4.0.12, by the way.

<script language="javascript" type="text/javascript" src="tinymce/tinymce.min.js"/>

As much as they should be, script tags are not self-closing. There may be a specific doctype that lets them be.

<script language="javascript" type="text/javascript" src="tinymce/tinymce.min.js"></script>

By the way, script tags should go before </body> unless you have inline javascript.

The problem caused by loading scripts is that they block parallel downloads. If the page is not parsed the user agent cannot know which subsequent resources need fetching, so a strictly conforming browser should not be able to fetch further resources until the first has actually been executed.

Since jQuery in particular shouldn't execute until the DOM hierarchy has been fully constructed, and HTTP/4.01 specification states "[a script] element may appear any number of times in the HEAD or BODY of an HTML document," it doesn't make sense to start those JavaScript downloads before the page's body has even started to download, and doing so would slow down the perceived page load.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM