PDA

View Full Version : IFrame SSI script II works with http://intranet/ but not http://intranet.domain.com/



Levi4884
09-08-2008, 08:03 PM
IFrame SSI script II
http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm

This script is brilliant. I've incorporated it into my company's intranet site for a project involving a photo directory. I thought it was working fine until today, when one of the managers tested it out and found a problem (talk about embarrassing). The page with the script works fine when you go to http://intranet/section/page.html but breaks when you go to http://intranet.domain.com/section/page.html. I'm not sure why that would really make any difference at all. The intranet is hosted internally and both of those addresses take you to the same page(s). I've tried changing the script from being embedded directly on the page to being a separate file with a relative link pointing to it, but besides that I have no clue what to do about this one. Any help would be greatly appreciated.

ddadmin
09-08-2008, 10:52 PM
Sub domains, or ones with the syntax subdomain.mysite.com is treated as a separate domain from mysite.com/subdomain/ as far as JavaScript is concerned. Due to this, the IFRAME SSI script will only work in one of the two, but not both unfortunately.

Levi4884
09-09-2008, 03:01 PM
Thanks for the quick reply. For anyone referring to this post in the future, I found a quick and easy solution. In the header tags of each HTML page I inserted a little bit of Javascript that looks at the current URL and changes it to the full URL if needed:

var currentURL = '' + window.location;

if (currentURL.match('http://intranet/dir/page.htm')){
window.location = 'http://intranet.domain.com/dir/page.htm';
}

Quick, easy, and it works!