| 172 | | print "Content-type: text/html\n\n"; |
| 173 | | print '<script type="text/javascript">'; |
| | 172 | print <<EOF; |
| | 173 | Content-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 | |
| | 208 | EOF |