Jump to content

lowlowz

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Posts posted by lowlowz

  1. Here is the scenario:

     

    I have phpbb installed inside of an iframe and I have all of these features working .....in firefox only:

    Iframe re-sizes to fit content

    external links within the forum open in a new window

    traffic to my /forum directory is redirected (with a javascript window.location.replace) to open inside of the iframe

     

    Essentially phpbb works perfectly in firefox

     

    When I load it in either Chrome or IE:

    My site index will load fine (as will any site feature that is not within the iframe)

    When I attempt to load my forum or request anything within the iframe IE and Chrome show the page for less than one second then continuously load a 404 page within the frame

     

    This leads me to believe that it is a problem with my redirect...but I have no clue.

     

    Here is the PHP, hopefully somebody can help:

     

    Iframe re-size code (in iframefile.php):

     

    <script type="text/javascript">
    
    /***********************************************
    * IFrame SSI script II- &#169; Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
    * Visit DynamicDrive.com for hundreds of original DHTML scripts
    * This notice must stay intact for legal use
    ***********************************************/
    
    //Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
    //Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
    var iframeids=["myframe"]
    
    //Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
    var iframehide="yes"
    
    var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
    var FFextraHeight=parseFloat(getFFVersion)>=0.1? 150 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers
    
    function resizeCaller(){
    var dyniframe=new Array()
    for (i=0; i<iframeids.length; i++){
    if (document.getElementById)
    resizeIframe(iframeids[i])
    //reveal iframe for lower end browsers? (see var above):
    if ((document.all || document.getElementById) && iframehide=="no"){
    var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
    tempobj.style.display="block"
    }
    }
    }
    
    function resizeIframe(frameid){
    var currentfr=document.getElementById(frameid)
    if (currentfr && !window.opera){
    currentfr.style.display="block"
    if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
    currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
    else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
    currentfr.height = currentfr.Document.body.scrollHeight;
    if (currentfr.addEventListener)
    currentfr.addEventListener("load", readjustIframe, false)
    else if (currentfr.attachEvent){
    currentfr.detachEvent("onload", readjustIframe) // Bug fix line
    currentfr.attachEvent("onload", readjustIframe)
    }
    }
    }
    
    function readjustIframe(loadevt) {
    var crossevt=(window.event)? event : loadevt
    var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
    if (iframeroot)
    resizeIframe(iframeroot.id);
    }
    
    function loadintoIframe(iframeid, url){
    if (document.getElementById)
    document.getElementById(iframeid).src=url
    }
    
    if (window.addEventListener)
    window.addEventListener("load", resizeCaller, false)
    else if (window.attachEvent)
    window.attachEvent("onload", resizeCaller)
    else
    window.onload=resizeCaller
    
    </script>

    ____________________________________________________

     

    This is (part of) the javascript redirect (in iframefile.php)

     

    <script type="text/javascript">
    var text = window.location.href;
    function delineate(str) {
    theleft = str.indexOf("=") + 1;
    theright = str.indexOf("&");
    return(str.substring(theleft, str.length));
    }
    url=delineate(text)
    
    function refreshFrame() {
    myframe.location.replace("http://www.mydomain/?var1='+window.location.href+'");
    }
    </script>

     

    This is the other part of the above javascript redirect that is in the overall_header to redirect pages requested within the forum to target the iframe via the code above:

     

    <script type="text/javascript">
    if (window == top) {
    var url='window.location.replace("/?var1='+window.location.href+'")';
    eval(url);
    }
    </script>

     

     

    This is the necessary code i had to add in my home directory index.php for the above two codes to work:

     

    <?
    ob_start();
    $vary = $_GET['var1'];
    $tee = $_GET['t'];
    if ( $vary == "" ) {
    // do nothing, no var
    } else {
    $gogogo = strtolower($vary);
    $healthy = array("http://mydomain/forum/", "http://www.mydomain/forum/");
    $yummy   = array("", "");
    $newphrase = str_replace($healthy, $yummy, $gogogo);
    
    $finalcode = base64_encode($newphrase);
    $healthy = array("+", "=");
    $yummy   = array("7PLUS7", "7EQUALS7");
    $newphraseu = str_replace($healthy, $yummy, $finalcode);
    if ( $tee == "" ) {
    header("Location: http://www.mydomain/iframefile.php?var=$newphraseu");
    } else {
    header("Location: http://www.mydomain/iframefile.php?var=$newphraseu&t=$tee");
    }
    }
    ob_flush();
    ?>

    ___________________________________

     

    And finally this is the code for my actual iframe (in iframefile.php):

     

    <?
    $healthy = array("7PLUS7", "7EQUALS7");
    $yummy   = array("+", "=");
    $newphraseu = str_replace($healthy, $yummy, $vary);
    
    $finally = base64_decode($newphraseu);
    if ( $tee == "" ) {
    $thedone = $finally;
    } else {
    $thedone = "$finally&t=$tee";
    }
    if ( $vary == "" ) {
    ?>
    <center><iframe onload="refreshFrame();" id="myframe" src="/forum" scrolling="no" marginwidth="0" frameborder="0" marginheight="0" vspace="0" hspace="0" style="overflow:invisible; width:100%; display:none"></iframe></center>
    <?
    } else {
    ?>
    <center><iframe onload="refreshFrame();" id="myframe" src="/forum/<? echo $thedone; ?>" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:invisible; width:100%; display:none"></iframe></center>
    <?
    }
    ?>

     

     

    Sorry for the long read.

    Again this all works perfect in firefox but with IE and Chrome the iframe keeps reloading a 404 page after showing the requested page briefly.

    Any and all help is appreciated!

     

    Thanks in advance :)

     

×
×
  • 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.