Loading Multiple TinyMCE instances is freezing the browser

I have a page with multiple tinymce instances running at the same time and it's freezing the browser whenever it loads. It's taking not less than 15 seconds of waiting before I could use the browser again. I've tested this on IE9, FF6, and Chrome and all of them are freezing for some time while it is loading.

How could I prevent this freezing from happening? I have at least 10 textarea with tinymce attached to it. Computer is running on core2duo with 4GB of RAM without any other program running, but this shouldn't matter as its supposed to work even with a lower spec PC.
Bandai2Asked:
Who is Participating?
 
ray-solomonConnect With a Mentor Commented:
No problem. Sorry for the late response. Its my birthday today and I am busy doing other things.

here is the example you requested:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="/js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">

tinyMCE.init({
	editor_selector : "mceEditor",
	theme : "advanced",
	plugins : "advimage,advlink,contextmenu,paste,advhr",
	theme_advanced_buttons1 : "fontselect,fontsizeselect, forecolor,backcolor",
	theme_advanced_buttons2 : "bullist,numlist,separator,outdent,indent,bold,italic,underline,justifyleft,justifycenter,justifyright,justifyfull,undo,redo",
	theme_advanced_buttons3 : "hr,removeformat,visualaid,charmap,cut,copy,paste,pastetext,pasteword,link,unlink,image,separator,code",
	theme_advanced_toolbar_location : "bottom",
	theme_advanced_toolbar_align : "left",
	theme_advanced_disable : "styleselect",
	apply_source_formatting : false,
	mode : "exact",
	width : "614px",
	elements : "t0",
	cleanup_on_startup : true,
	verify_html : true,
	cleanup : true,
	preformatted : false,
	forced_root_block : false,
	force_br_newlines : false,
	force_p_newlines : true,
	theme_advanced_source_editor_wrap : true,
	//convert_urls : true,
	remove_script_host : true,
	relative_urls : false,
	visual : false,
	setup : function(ed) {
		ed.onInit.add(function(ed) {
			setTimeout(function() { 
				var x = 0;
				(function loop(i) {
					if (i < editorIDs.length) {
						createEditor(editorIDs[i]);
						setTimeout(function() { loop(++i); }, 5000);
					}
				})(x);
			}, 5000);
		});
	}
});

/* Predefine IDs for textareas that will be created */
var editorIDs = new Array('t1', 't2', 't3', 't4', 't5');

function createEditor(id) {
	
	var textarea = document.createElement('textarea');
	textarea.id = id;
	textarea.cols = '45';
	textarea.rows = '5';
	document.body.appendChild(textarea);
	var new_editor = new tinymce.Editor(id, {});
	new_editor.render();
}
</script>
<style type="text/css">
textarea {
	-moz-border-radius: 0px;
	-webkit-border-radius: 0px;
	background-color: #FFF;
	width: 594px;
	height: 300px;
}
</style>
</head>

<body>
<textarea name="t0" id="t0" cols="45" rows="5"></textarea>
</body>
</html>

Open in new window

0
 
ray-solomonCommented:
Some questions.

1) have you viewed it from a different computer/internet connection?

2) are you using TinyMCE compressor? - see the faq

3) Have you considered allowing only one instance to load by default instead of all 10? e.g. The user can press a button to instantiate more editors where applicable.


0
 
Bandai2Author Commented:
1) Yes I tried it using a different computer (an older one) and the freeze time is longer.

2) I'm checking out the TinyMCE compressor now, but I don't think this would stop the freezing at all.

3) You mean the "Load on demand"? I don't think that's a good idea, think about how that would impact you if you need to click a button first every time you want to input something to every field. What a hassle.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
ray-solomonCommented:
Another way is to activate each editor in 5 seconds intervals or so. The page should load faster this way.

Have you tried using less theme options in your configuration? - e.g. A Full featured editor will load slower than a slimmed down version.
0
 
Ray PaseurCommented:
I've never had success using more than one instance of TinyMCE on the same page, so don't feel bad if it doesn't work out for you.  I like the idea that ray-solomon suggested about having the user press a button to instantiate more editors.  I think I might want to put more editors on more pages - with one per page.
0
 
Bandai2Author Commented:
Hi ray-solomon, any idea how I could load each tinymce instances in a 5 seconds interval?
0
 
Bandai2Author Commented:
Just an update, implemented the compressor as well but it is still freezing for some time before loading.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.