Changeset 1195

Show
Ignore:
Timestamp:
2007-12-13 05:36:54 (10 months ago)
Author:
martinkou
Message:

Made the debug window work in domain relaxation mode.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/branches/features/floating_dialog/editor/fckdebug.html

    r132 r1195  
    3131var oWindow ; 
    3232var oDiv ; 
     33 
     34// Automatically detect the correct document.domain (#123). 
     35(function() 
     36{ 
     37        var d = document.domain ; 
     38 
     39        while ( true ) 
     40        { 
     41                // Test if we can access a parent property. 
     42                try 
     43                { 
     44                        var parentDomain = window.opener.document.domain ; 
     45 
     46                        if ( document.domain != parentDomain ) 
     47                                document.domain = parentDomain ; 
     48                        break ; 
     49                } 
     50                catch( e ) {} 
     51 
     52                // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... 
     53                d = d.replace( /.*?(?:\.|$)/, '' ) ; 
     54 
     55                if ( d.length == 0 ) 
     56                        break ;         // It was not able to detect the domain. 
     57 
     58                document.domain = d ; 
     59        } 
     60})(); 
    3361 
    3462if ( !window.FCKMessages )