Log in

View Full Version : iframe question



pigsfoot
08-29-2007, 09:57 AM
Hi,

I'm new to this forum so apologies if this has been answered before, I have looked but didn't find anything.

I am writing a website that needs to use iFrames, I know there not great but the system runs off a bid MySQL database which then feeds several websites hence the reason i need them.

The issue I have is being able to alter the height of an iframe via a hyperlink.

The site address is http://www.smovemovedemo.co.uk , this is my work in progress site so it's a bit messy I’m afraid.

The index page center frame calls the different pages via iframe tags. The first page also sets the default centre iframe height to be around 900px.

What I need to be able to do is when the show ads ( bottom left ) link is clicked the hyper link calls a new page and places it in my centre frame. The problem is this page is built from the database and shows houses for sale. When the page is put together the height is around 300px taller than the default so i need to change the height on the fly for different pages.

The code for my first page is

<iframe Name="centremain" FRAMEBORDER="0" HEIGHT="898" WIDTH="708" src="http://www.smovemovedemo.co.uk/mainpagecontent.htm"></iframe>

The code for the hyper link is

<A HREF="http://www.smovemove.co.uk/estate/cgi-bin/mojoEstate.cgi?type=search&action=search&cat_c=0&min_property_price=0&max_property_price=100000000&cat_a=&submit.x=27&submit.y=24" TARGET="centremain" title="text by rod">show ads</a>

Is this possible ??. I have looked at various Java Script solutions but they don't seem to work via a hyperlink.

Any help would be appreciated as I have been working on this for 3 days now and it's getting frustrating.

Thanks.... Pigsfoot

codeexploiter
08-29-2007, 01:12 PM
You need to adjust the height of the Iframe using some JavaScript code. It is not possible to have a 100&#37; height for Iframes.

Please have a look at this script available in this site Iframe SSI II (http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm) and integrate the script as it needs based on its documentation.

boogyman
08-29-2007, 01:39 PM
if you are using a database chances are your site supports some type of server-side language (PHP / ASP) If that is the case I would suggest you might look into redesigning your site using a server-side program, and you will not have to worry about the iframe.

the drawback for using frames in general is that they are very hard to bookmark, so if anyone were to go to your site and scroll through a bunch of links to get to 1 portion and try to bookmark it, the next time they returned, they would be brought back to the beginning page, which as you can probably see causes them to re-find what they were intending to bookmark.

pigsfoot
08-29-2007, 07:11 PM
Thanks for your help Code Exploiter.

I have tried the code and it part works. When calling pages from within the same domain it works very well. Unfortunately the page i am having trouble with is called from another domain that hosts the database and all the main pages.

The website does say this code will not work with external pages from another domain.

So thanks for your help but i need to go that bit further and call a page from another domain.

One thing this code does do is automatically resize the page which is cool... but i don’t need to be that cleaver, all i want to do is fix the height of a page in px's when calling a page from another domain to view within an Iframe.

At least it shows it's possible.

Thanks....Pigsfoot

pigsfoot
08-29-2007, 07:15 PM
BoogyMan, thanks for your input.

I understand what your saying but it is very unlikely that anyone would want to bookmark a page. Basically the site is an estate agent portal which is fed information from my main site, www.smovemove.co.uk. The idea is to be able to display property on the mini sites by a specific estate agent hence why the data is called from my main site with the database running.

Cheers...Pigsfoot

codeexploiter
08-30-2007, 08:33 AM
Check this one (http://www.kaali.co.uk/article-Cross-bowser-iframe-auto-resize-script-94.htm) out

pigsfoot
08-30-2007, 03:44 PM
Thanks for the update but i still get the same problem. Because i need to display a page from a different domain the dynamic resize dosn't work.

I think from looking round and the way Javascript works it dosn't look like it is possible.

Thanks for you help...Pigsfoot