Show
Ignore:
Timestamp:
2008-03-25 08:57:35 (7 months ago)
Author:
wwalc
Message:

Fix for #1919 (file browser & relaxation mode issue)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/filemanager/connectors/perl/commands.pl

    r1649 r1791  
    170170        local($sErrorNumber, $sFileUrl, $sFileName, $customMsg) = @_; 
    171171 
    172         print "Content-type: text/html\n\n"; 
    173         print '<script type="text/javascript">'; 
     172        print <<EOF; 
     173Content-type: text/html 
     174 
     175<script type="text/javascript"> 
     176// Automatically detect the correct document.domain (#1919). 
     177(function() 
     178{ 
     179        var d = document.domain ; 
     180 
     181        while ( true ) 
     182        { 
     183                // Test if we can access a parent property. 
     184                try 
     185                { 
     186                        var test = window.top.opener.document.domain ; 
     187                        break ; 
     188                } 
     189                catch( e ) {} 
     190 
     191                // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... 
     192                d = d.replace( /.*?(?:\\.|\$)/, '' ) ; 
     193 
     194                if ( d.length == 0 ) 
     195                        break ;         // It was not able to detect the domain. 
     196 
     197                try 
     198                { 
     199                        document.domain = d ; 
     200                } 
     201                catch (e) 
     202                { 
     203                        break ; 
     204                } 
     205        } 
     206})() ; 
     207 
     208EOF 
    174209        print 'window.parent.OnUploadCompleted(' . $sErrorNumber . ',"' . JS_cnv($sFileUrl) . '","' . JS_cnv($sFileName) . '","' . JS_cnv($customMsg) . '") ;'; 
    175210        print '</script>';