Index: /FCKeditor/trunk/editor/filemanager/connectors/test.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/test.html	(revision 1793)
+++ /FCKeditor/trunk/editor/filemanager/connectors/test.html	(revision 1794)
@@ -28,4 +28,36 @@
 	<script type="text/javascript">
 
+// Automatically detect the correct document.domain (#1919).
+(function()
+{
+	var d = document.domain ;
+
+	while ( true )
+	{
+		// Test if we can access a parent property.
+		try
+		{
+			var test = window.opener.document.domain ;
+			break ;
+		}
+		catch( e ) {}
+
+		// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
+		d = d.replace( /.*?(?:\.|$)/, '' ) ;
+
+		if ( d.length == 0 )
+			break ;		// It was not able to detect the domain.
+
+		try
+		{
+			document.domain = d ;
+		}
+		catch (e)
+		{
+			break ;
+		}
+	}
+})() ;	
+	
 function BuildBaseUrl( command )
 {
Index: /FCKeditor/trunk/editor/filemanager/connectors/uploadtest.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/uploadtest.html	(revision 1793)
+++ /FCKeditor/trunk/editor/filemanager/connectors/uploadtest.html	(revision 1794)
@@ -27,4 +27,36 @@
 		<script type="text/javascript">
 
+// Automatically detect the correct document.domain (#1919).
+(function()
+{
+	var d = document.domain ;
+
+	while ( true )
+	{
+		// Test if we can access a parent property.
+		try
+		{
+			var test = window.opener.document.domain ;
+			break ;
+		}
+		catch( e ) {}
+
+		// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
+		d = d.replace( /.*?(?:\.|$)/, '' ) ;
+
+		if ( d.length == 0 )
+			break ;		// It was not able to detect the domain.
+
+		try
+		{
+			document.domain = d ;
+		}
+		catch (e)
+		{
+			break ;
+		}
+	}
+})() ;	
+		
 function SendFile()
 {
