PcGeniusProductions Posted October 20, 2008 Share Posted October 20, 2008 Hi guys. I a nearly 100% certain that this is not possible without heroic coding, but for some reason, I have been sucked into the forums to ask the question, once and for all... Is this possible: An address, which goes to a web-page, then redirects an iframe within the specified page? e.g. http://example.com/mypage.php?iframe=http://example.com/mypage.html Or something similar? I am using Joomla v1.5.7, using PHPv5 and SQL(i) These are nothing to do with it, true, but anyways... Thanks in advance for any help anyone can give. Quote Link to comment https://forums.phpfreaks.com/topic/129322-iframe-redirect/ Share on other sites More sharing options...
genericnumber1 Posted October 21, 2008 Share Posted October 21, 2008 I think I know what you mean... but I may be oversimplifying the question <iframe src="<?php echo $_GET['iframe']; ?>" height="500">You don't support iframes, bro!</iframe> heck, that's probably not what you want... Can you better explain your problem? Quote Link to comment https://forums.phpfreaks.com/topic/129322-iframe-redirect/#findComment-670545 Share on other sites More sharing options...
PcGeniusProductions Posted October 21, 2008 Author Share Posted October 21, 2008 Hi GenericNumber1. Yes, this is what I meant. I have created my own script that does exactly what yours does, only I have given it a default base-url, so instead of going: xxx.com?=http://xxx.com/page.php i only need to put the page variable "?viewtopic=xxx" and not the whole url. Thanks for your help. What you said would have been great value to me. I appreciate that. Here is what I used. (for similar issues) Where as your script would give me: http://******/forum?iframe=http://example.com/forum/viewforum.php?f=155 Mine gives me: http://******/forum?get=viewforum.php?f=155 My entire page looks like this: <?php if (!isset($_GET['target'])) {$target = "/forum-standard/"; } else {$target = $_GET['target'];} ?> <script language="javascript" type="text/javascript"> function iFrameHeight() { var h = 0; if ( !document.all ) { h = document.getElementById('blockrandom').contentDocument.height; document.getElementById('blockrandom').style.height = h + 60 + 'px'; } else if( document.all ) { h = document.frames('blockrandom').document.body.scrollHeight; document.all.blockrandom.style.height = h + 20 + 'px'; } } </script> <iframe height="500" frameborder="0" width="933" scrolling="no" align="top" onload="iFrameHeight()" id="blockrandom" name="iframe" src="<?php print $target; ?><?php echo $_GET['get']; ?>" class="wrapper">The ColdCast Forums are not available at this time. Sorry. </iframe> I am sure there will be a more efficient way of doing this, but for now, this will do. My main (and very small) issue is that the page loads fine, but when the iframe changes url, e.g. when a link is clicked, the parent-url stays put, thus giving users the wrong impression if they wanted to send a friend the link. Does anyone know a fix for this? Quote Link to comment https://forums.phpfreaks.com/topic/129322-iframe-redirect/#findComment-671155 Share on other sites More sharing options...
Rebel7284 Posted October 21, 2008 Share Posted October 21, 2008 <a href="parent.location='<?stuff?>'>link in iframe</a> can do it by refreshing the parent which as a result refreshes the iframe too. Quote Link to comment https://forums.phpfreaks.com/topic/129322-iframe-redirect/#findComment-671160 Share on other sites More sharing options...
PcGeniusProductions Posted October 21, 2008 Author Share Posted October 21, 2008 Hmm, I see what you mean (i think) but would I not need to apply this to all of the links inside the iFrame? (an entire phpbb3 setup) thanks for your rapid reply, btw Quote Link to comment https://forums.phpfreaks.com/topic/129322-iframe-redirect/#findComment-671167 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.