| | 105 | (function() |
| | 106 | { |
| | 107 | var d = document.domain ; |
| | 108 | |
| | 109 | while ( true ) |
| | 110 | { |
| | 111 | // Test if we can access a parent property. |
| | 112 | try |
| | 113 | { |
| | 114 | var test = window.top.opener.document.domain ; |
| | 115 | break ; |
| | 116 | } |
| | 117 | catch( e ) {} |
| | 118 | |
| | 119 | // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... |
| | 120 | d = d.replace( /.*?(?:\.|$)/, '' ) ; |
| | 121 | |
| | 122 | if ( d.length == 0 ) |
| | 123 | break ; // It was not able to detect the domain. |
| | 124 | |
| | 125 | try |
| | 126 | { |
| | 127 | document.domain = d ; |
| | 128 | } |
| | 129 | catch (e) |
| | 130 | { |
| | 131 | break ; |
| | 132 | } |
| | 133 | } |
| | 134 | })() ; |
| | 135 | |