Log in

View Full Version : Keep Page Within <iFrame>



nightclubindustry
12-06-2007, 04:13 PM
I recently embeded a phpbb forum into the discussion page of my site using iframes. When I sign in through the main "index.php" page everything works fine and stays within the iframe. But if I sign in through the "login.php" page, a seperate window opens for the forum. How can I keep the page within the iframe?

Reference: "http://www.nightclubindustry.com/discussions.html"

Thanks in advance.

djr33
12-06-2007, 07:12 PM
You can't really force this. You could, I suppose, try to place some javascript on the page that would detect if it has a parent (a page holding it as an iframe), then see what this page was, guess as best it could if this is valid, and if not then redirect to the correct setup.... but that relies on Javascript, so it can be easily avoided by anyone who wants to, and is just a lot of extra work.

However, your question might be simpler-- how do you deal with just having it stay in the same window (frame) by default when clicking a link?

You'll need to find the target attribute (this exists for a form, a link, and even in Javascript activated links) and just change that to "_self". "_blank" is the setting for a new window, so looking for that might help you find the problem.

nightclubindustry
12-06-2007, 10:31 PM
DJR33

I was able to find the neccessary file and made the attribute change from "_top" to "_self" this was much easier than adding script.

Thanks

djr33
12-07-2007, 05:15 AM
Ok, great. I wasn't sure if you were asking to FORCE it stay within an iframe (hard, and needs complex scripting, as well as not secure), or just make it work by default. Glad it worked out.

torrent
12-07-2007, 09:55 PM
I had a similar problem but wasnt able to fix it this way because I have no control over the sites that load in my iFrame. So if you want to try another solution just in case yours has a problem check this out. And its cross browser safe. :D
http://dhtmlnirvana.com/content/dhtml/autofit/autofitiframe.html