Index: /CKEditor/trunk/CHANGES.html
===================================================================
--- /CKEditor/trunk/CHANGES.html	(revision 5105)
+++ /CKEditor/trunk/CHANGES.html	(revision 5106)
@@ -91,5 +91,6 @@
 		<li><a href="http://dev.fckeditor.net/ticket/4886">#4886</a> : Extra BR tags were being created in the output HTML.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/4933">#4933</a> : Empty tags with BR were being left in the DOM.</li>
-		<li><a href="http://dev.fckeditor.net/ticket/5127">#5127</a> : Remove dialog definition pages somtimes been error prone.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/5127">#5127</a> : Remove dialog definition pages sometimes been error prone.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4767">#4767</a> : CKEditor does not work when ckeditor_source.js is loaded in the &lt;body&gt; .</li>
 		<li>Updated the following language files:<ul>
 			<li><a href="http://dev.fckeditor.net/ticket/5006">#5006</a> : Dutch;</li>
Index: /CKEditor/trunk/_source/core/loader.js
===================================================================
--- /CKEditor/trunk/_source/core/loader.js	(revision 5105)
+++ /CKEditor/trunk/_source/core/loader.js	(revision 5106)
@@ -162,6 +162,6 @@
 				// We must guarantee the execution order of the scripts, so we
 				// need to load them one by one. (#4145)
-				// The followin if/else block has been taken from the scriptloader core code.
-				if ( CKEDITOR.env.ie )
+				// The following if/else block has been taken from the scriptloader core code.
+				if ( typeof(script.onreadystatechange) !== "undefined" )
 				{
 					/** @ignore */
@@ -191,5 +191,5 @@
 			/**
 			 * Loads a specific script, including its dependencies. This is not a
-			 * synchronous loading, which means that the code the be loaded will
+			 * synchronous loading, which means that the code to be loaded will
 			 * not necessarily be available after this call.
 			 * @example
@@ -218,5 +218,8 @@
 
 				// Append the <script> element to the DOM.
-				if ( document.body )
+				// If the page is fully loaded, we can't use document.write
+				// but if the script is run while the body is loading then it's safe to use it
+				// Unfortunately, Firefox <3.6 doesn't support document.readyState, so it won't get this improvement
+				if ( document.body && (!document.readyState || document.readyState == 'complete') )
 				{
 					pendingLoad.push( scriptName );
