PDA

View Full Version : Odd issue with Dynamic iFrame and IE7



ImMelody
03-05-2008, 02:20 AM
1) Script Title: IFrame SSI Script II

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm

3) Describe problem: I get an "Error on Page" message on IE7 for my website. The kicker is that it only comes up when I don't have www. in front of the rest of my website. The error comes up


Line: 42
Char: 6
Error: Permission denied
Code:0
URL: http://ctsites.net/

It took asking a friend for me to find out the error was only when I didn't have www. I'm not sure if this is a bug or something wrong with the script on my page, so I didn't report it as a bug.

jscheuer1
03-05-2008, 05:37 AM
When the top page has no www and the contained page does (or visa versa), IE thinks it is a different domain, from the demo page:


*All external pages loaded into the iframe must be from the same domain as the page the iframe tag is inserted in. Setting the iframe's src to an external site such as "http://www.google.com" will not work, since the script cannot probe and detect the height of pages from external domains.

You could avoid this by using relative paths (and/or network paths), that way however a user arrives at your site, when they load other content into the iframe it will have the same base domain, whether it be with or without the www part.

A relative path is like (for a page in the same folder):


<a href="somepage.htm">Something</a>

But let's say you are using an absolute path:


<a href="http://www.ctsites.net/ipages/somepage.htm">Something</a>

There http://www.ctsites.net/ is pretty much just saying 'start from the root'. The below network path with its leading slash does the same thing:


<a href="/ipages/somepage.htm">Something</a>

With both the relative and the network path, the browser will see the root domain as whatever it appears to be in the address bar. If you use the absolute path, it is a toss up as to whether or not it will match the way the user got to your site.