HTML page loads external frame

Discussion in 'HTML' started by Silver, Jun 20, 2006.

  1. Silver

    Silver Guest

    I have a main page that includes one menu and one iFrame.
    Depending on the selections made on a menu, a different html page is
    loaded inside the iFrame. The menu is just a list of <a href=...>

    i.e. The user presses the "first" key on the menu, then the first page
    is loaded inside the frame.

    Find here a sample for the pages I use.

    index.html
    ==========================================
    <html>
    <body>
    <!-- menu here -->
    <iframe src="first.htm"></iframe>
    </body>
    </html>
    ==========================================

    first.html
    ==========================================
    <p>
    Hello world
    </p>
    ==========================================

    Here is my question. I want that when someone types in the browser
    addressbar the address www.mysite.com/first.html, then instead of
    loading just the "first.htm" l file, I want to see the entire
    "index.html" page and the "first.html" file loaded inside the iFrame.
    Is it possible? How can I do in order to do it?
    Thank you much in advance.

    Mario Jannelli
    www.silverino.com
     
    Silver, Jun 20, 2006
    #1
    1. Advertisements

  2. No
     
    David Dorward, Jun 20, 2006
    #2
    1. Advertisements

  3. Silver

    Evertjan. Guest

    David Dorward wrote on 20 jun 2006 in comp.lang.javascript:
    Yes [if the diference between .htm and .html is a typo]


    ============= in first.html =============

    <script type='text/javascript'>
    if (self == top) location.href='index.html?f=first.html'
    </script>

    ============= in index.html =============

    select the f=filename by location.hash and load the iframe.
     
    Evertjan., Jun 20, 2006
    #3
  4. Better to do it with server-side and not depend on JavaScript

    index.php?f=first.html

    It is one of the nasty bit with frames, (iframes included) and I guess
    to prevent breaking out of frames a non-javascript solution would be a
    rewrite in the .htacess file.
     
    Jonathan N. Little, Jun 20, 2006
    #4
  5. Oh, misunderstood the question. It isn't trying to capture *any* page the
    user tries to visit in the frame.
     
    David Dorward, Jun 20, 2006
    #5
  6. Silver

    Evertjan. Guest

    Jonathan N. Little wrote on 20 jun 2006 in comp.lang.javascript:
    Sure, but it can be done clientside.

    There are no frames to break out if (self == top), not?
     
    Evertjan., Jun 20, 2006
    #6
  7. Silver

    Evertjan. Guest

    David Dorward wrote on 20 jun 2006 in comp.lang.javascript:
    No harm done, that what's a NG is all about.
     
    Evertjan., Jun 20, 2006
    #7
  8. Silver

    jojo Guest

    Evertjan. wrote:
    [Yes]
    For what reason do you need the hash? Its also possible to use SSI (if
    available on the Server) and write into "index.html"

    <iframe href="<!--#echo var="http_referer"-->"></iframe> (Don't worry
    about the tag-looking construction in another Tag, this is just a
    SSI-command which is replaced from the server before any browser has to
    validate it)
     
    jojo, Jun 20, 2006
    #8
  9. I didn't say it couldn't, just that it is better done server-side.
    Won't work if I have JavaScript disabled....
     
    Jonathan N. Little, Jun 20, 2006
    #9
  10. Silver

    Evertjan. Guest

    Jonathan N. Little wrote on 20 jun 2006 in comp.lang.javascript:
    You are repeating yourself.
    That can be said for all clientside code on this NG
    and has nothing to do with the surmized nastiness of frames above.

    So what is your point?
     
    Evertjan., Jun 20, 2006
    #10
  11. Silver

    Evertjan. Guest

    jojo wrote on 20 jun 2006 in comp.lang.javascript:
    Because this NG is about javascript, and perhaps especially clientsided.

    It can also be done by serverside javascript.
     
    Evertjan., Jun 20, 2006
    #11
  12. Silver

    jojo Guest

    I'm sorry, I missed that this question is crossposted... I read it at
    alt.html which does not only deal with JavaScript...
     
    jojo, Jun 20, 2006
    #12
  13. Silver

    Evertjan. Guest

    jojo wrote on 20 jun 2006 in comp.lang.javascript:
    Same here but inverted.
     
    Evertjan., Jun 20, 2006
    #13
  14. Yes I am, your remarks seemed to challenge my assertions that
    client-side option is vulnerable to client browser settings where are
    server-side is not. Or is your problem a perspective problem, not
    realizing this is a cross-posted thread.
    If you look he has cross-posted to alt.html where I am posting from. The
    scope is a little more generalized.
     
    Jonathan N. Little, Jun 20, 2006
    #14
  15. Silver

    Evertjan. Guest

    Jonathan N. Little wrote on 20 jun 2006 in comp.lang.javascript:
    Roger, oversaw the short named NG.
     
    Evertjan., Jun 21, 2006
    #15
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.