SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 37 of 37

Thread: Iframe

  1. #26
    SitePoint Evangelist
    Join Date
    Jul 2004
    Location
    USA
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok so how could I modify the above script to check for the onload to change? Basically that shounds exactly what i need, for when the page in the iframe loads a new page, to refresh the main page.
    BKerr

  2. #27
    SitePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're going to have an additional problem, because if you refresh your main page it will go back and reload the iframe to its original page as well. You may be better off with a regular frameset document, so you can make the frames more independent.

  3. #28
    SitePoint Evangelist
    Join Date
    Jul 2004
    Location
    USA
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That is what I want it do to I want it to refresh the iframe to the page it started at.
    BKerr

  4. #29
    SitePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, let me get this right, you basically want to prevent the user from changing the page in the iframe?

  5. #30
    SitePoint Evangelist
    Join Date
    Jul 2004
    Location
    USA
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    basically, let me explain it.

    Its a clicker for a game. You have to click a link on a page in order for your "player" to grow in size.

    I want to place this page inside the iframe, so I can keep stats on it. So when they click the captcha image on the page, and it reloads to the submit page (still within the frame), i want the main page to refresh and show the original page in the iframe again (so they can click again)
    BKerr

  6. #31
    SitePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm. It sounds like the page in the frame is reloading once or twice, before you want to return to the original. Is that so?

  7. #32
    SitePoint Evangelist
    Join Date
    Jul 2004
    Location
    USA
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its just reloading once.
    BKerr

  8. #33
    SitePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem, then, will be avoiding an endless loop, where the onload triggers one reload after another. Try something like this:

    Code:
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
      <html>
      <head>
      <title>Untitled</title>
      <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
      <style type="text/css">
      </style>
      <script type="text/javascript">
      window.onload=function(){
        targ=document.getElementById('ifOne');
        targ.onload=getBack;
      }
      function getBack(){
        targ.onload=resetGetBack;
        targ.src="target_file.htm";
      }
      function resetGetBack(){
        targ.onload=getBack;
      }
      </script>
      </head>
      <body>
      <div style="position:relative;">
      <iframe id="ifOne" src="target_file.htm"></iframe>
      </div>
      </body>
      </html>

  9. #34
    SitePoint Evangelist
    Join Date
    Jul 2004
    Location
    USA
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It never reloads
    BKerr

  10. #35
    &#083;itePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Then you aren't changing URLs in the iframe, or the iframe never finishes loading. Without a change in URL, no onload will fire and you're probably just out of luck.

  11. #36
    SitePoint Evangelist
    Join Date
    Jul 2004
    Location
    USA
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    BKerr

  12. #37
    &#083;itePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, but no, since only the GET data has changed, not the acutal page URL.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •