PDA

View Full Version : A Question regarding IFrame SSI Script II



PC-Gear
08-02-2007, 01:37 AM
1) Script Title: IFrame SSI Script II

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

3) Describe problem: How would it be possible to implement a variable on the source webpage that sets the IFrame's height when you are trying to display an IFrame from another domain.

To explain...
We need to display content from another website (our shopping cart) in our IFrame and bypass the "Permission Denied" error message so it's not reported (no error is triggered), and get the static height of the particular page that's hard-coded into the page that we need loaded into the IFrame.

Maybe by putting a variable (or something) in the page that's being loaded into the IFrame that reports the desired static height. (i.e. SetPageHeight = 800pix) or maybe a JS function that's called after the page has finished loading that sets the height.

We have access to all pages that we need to display, even though it's on another domain. So each page that we need to load into the IFrame can each have the custom "tag" added to it.

From our limited understanding of javascript, it seems that this would be possible. What would be the best way to implement?

Whew...:)

Veronica
08-02-2007, 08:54 PM
It's not possible to capture the height information needed for the script to work, if it's on a different domain. Even though you own both domains, and even if you were to put information or script on the shopping cart pages, browser security won't allow scripts to get that kind of information from a page, if the page is loaded from a different domain.

PC-Gear
08-02-2007, 10:25 PM
Thanks Veronica.

How about the following, then:

Is there a way to trap the error, or stop it from happening altogether, if the loaded page is from a foreign domain? To see if the page the user is trying to load is foreign to begin with?

If the page I'm loading is from a foreign domain, don't try to get the scrollheight so the error is not thrown. Instead, set the height of the document to a static (coded) height in the IFrame parents' document. Something like this: "if pagename="cart.asp" then scrollheight=800", if pagename = "page2.asp", then scrollheight= 1024"

Is this possible?

Veronica
08-03-2007, 01:14 AM
That might work if the link to the cart page was on the main page with the javascript. But I don't think it would work if the link to the cart is on the page that's already loaded into the iframe.

jscheuer1
08-03-2007, 03:04 AM
You cannot query any information about the foreign page. I saw this post earlier, and have been thinking about it. Why use iframe ssi? Why not use a script where the user can resize the iframe as desired? See:

http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

Notice the Google 'window'. It is really just a dressed up iframe. It can easily be resized by tugging at the bottom right corner with the mouse.

PC-Gear
08-04-2007, 05:07 PM
Thanks for responding so quickly.

Veronica: it is on the same page as the main scripts.
Veronica, how do you check to see the name of the page that is loading (or loaded) into the IFrame. Do you have to capture the info when the user first clicks the link to load the page? or can you get the name of the page on the onload event?

Also, one you have obtained the name of the page, how do you statically set the height of the IFrame?

Can you come up with any script examples for what we need?

jscheuer1:
I would prefer to use it with the IFrame SSI II script, if possible. It works perfectly for all of the other pages, it's just a few pages that are problematic.

Does that script that you recommended maintain session information from the parent browser window with the pop-up windows?