#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    3
    Rep Power
    0

    Loading frameset html into div


    I use this system to dynamically load pages beacuase my website is graphics heavy (unfortunately the system does indeed exclude netscape for now...) I found it on the internet somewhere, it looks like this:

    PHP Code:
    (not php like the title says ofcourse!! but javascript)
    <
    script>
    function 
    loadPageurl )
    {
           
    parent.bufferFrame.document.location nUrl;
    }

    function 
    loadPageFinishid )
    {
           
    document.all[id].innerHTML parent.bufferFrame.document.body.innerHTML;
    }
    </script>
    <body>
          <iframe style="display:none" name="bufferFrame"></iframe>
          <div id="contents"></div>
    </body> 
    When a page calls loadPage, then this function loads the asked page into the bufferFrame that is invisible, as soon as this is loaded a script call is made from the loaded page: loadPageFinish( 'contents' ) and the page is copied and visible.


    However! This won't work for external pages as they do not call my loadPageFinish function...

    ----
    So, I thought I might use frames, then copy the innerHTML of the external page into the DIV. This is also not possible because external domain pages are protected from anything that might alter the content!!

    ----
    Then I thought, I don't need to copy the innerHTML, I can just make the innerHTML the frameset I need, like this:

    PHP Code:
    document.all['contents'].innerHTML '<frameset rows="*"><frame name="ExtMain" noresize src="'
                                       
    nUrl
                                       
    '"></frameset>'
    but that doesn't load anything either. I kinda wanna bet on this last option being able to work somehow!!

    ----------------------------------------------------------------------

    Who has any suggestions, on what I did wrong, or whatever other thing I could try?
    Last edited by RwDwR; December 19th, 2003 at 04:33 PM.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    3
    Rep Power
    0
    I also tried doing the following

    document.all[id].innerHTML = parent.bufferFrame.document.body.outerHTML;

    (unspecified error comes up)


    It doesn't work, BUT, when I try this:

    document.all[id].innerText = parent.bufferFrame.document.body.outerHTML;

    then the page shows this:

    <FRAMESET border=0 frameSpacing=0 rows=* frameBorder=0>
    <FRAME name=ExtMain marginWidth=0 marginHeight=0 src="http://www.anysite.com/a_page.php" frameBorder=NO noResize>
    </FRAMESET>



    why doesn't this work??????
    Last edited by RwDwR; December 20th, 2003 at 04:04 AM.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    3
    Rep Power
    0
    Ok, I think I figured out why it aint working...

    All other content that does work is allowed within the body tag. i forgot that the div element is not a html page, but just an element of which I was setting the innerHTML to a certain value.


    HOWEVER, I would still like to be able to display any page from another domain inside my nice DIV
    Any thoughts?

IMN logo majestic logo threadwatch logo seochat tools logo