View Full Version : Another Iframe Problem
mdray00
07-18-2007, 09:19 AM
hi guys dont know if any1 can help me I have looked everywhere but cant seem to find the answer.
I have a site that is based on the shopping cart cubecart.
I have an iframe on 1 of the pages which displays certain search results.
however when i click of the items that are in the iframe they load up inside the iframe and i need them to load in the main window. I have read that I need to use the target="_top" of the links but since they are all compiled using php code im not sure how to do this.
Is there a way of just telling the iframe that any links inside it should be opened in the "_top" ?
Thanks guys
djr33
07-18-2007, 09:41 AM
In the head section, I believe you should be able to use this tag:
<base target="_top">
[Edit: Corrected from 'href' to 'target'.)
mdray00
07-18-2007, 10:03 AM
No i still loads in the iframe not in the main window?
I added
<base href=www.healthier-options.com/sports/"_top">
to the head section on the page that loads in the iframe is that correct?
djr33
07-18-2007, 10:17 AM
No....
Just exactly what I had.
_top is the top level of the current page, relative, so you don't need to specify a URL.
And even if there were a need to have a URL, it would go in the quotes.
For html, you always need <tag property="value">, not <tag property=value>, or some version of that.
mdray00
07-18-2007, 10:28 AM
http://www.healthier-options.com/sports/index.php?act=viewDoc&docId=64
this is the page you can see the iframe at the bottom.
an example of the link in the frame is
http://www.healthier-options.com/sports/index.php?act=viewProd&productId=30
but if I do what u sugested (<base href="_top">)
then the links become (http://_top/index.php?act=viewProd&productId=30)
even then i only opens in the iframe and just says page cannot be displayed
djr33
07-18-2007, 10:50 AM
Oh!
Sorry about that. You're right.
It should be <base target="_top">
I was thinking of the wrong property. But, hey, if you need to specify a base href, now you know :p
mdray00
07-18-2007, 10:55 AM
sorry its still not workin. do i put this in the page that contains the iframe of the page that loads in the iframe? the <base target="_top"> means that all the links are now back to normal but they still only load inside the iframe?
Am I doin sumthing stupid?
mdray00
07-18-2007, 11:06 AM
sorry mate this is very strange.
I put just a normal <a href link n the page and when u click it it opens in the top window. However all the other links dont. Is it to do with them being complied through php rather than being a normal link?
djr33
07-18-2007, 11:19 AM
The base tag sets a default for the page.
target="_self" on those links is overriding the base target.
mdray00
07-18-2007, 11:24 AM
yea i had a look in the source and your right they all have a target="_self" command on every link.
But I dont know where the link is complied from so I cant turn the ="-self" to ="-top"
djr33
07-18-2007, 11:28 AM
I can't really help you there, but you should be able to find the source somewhere within the PHP code.
By the way, here's a list of targets, just to give you an idea:
_top -- outermost frame
_self -- same page
_blank -- new window
_parent -- next outer frame, like _top, but only one level
framename -- it will open in that frame
windowname -- it will open in that window
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.