Jump to content

iFrame Redirect


PcGeniusProductions

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/129322-iframe-redirect/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/129322-iframe-redirect/#findComment-671155
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.