Question:

How can I make an iframe reload on a page?

by  |  earlier

0 LIKES UnLike

I've created a menu with different links and iframes. One of the links is a "home" link. How can I make it go back to the home page? The problem is that the links are opening different iframe names, so the menu at the top is calling for a different frame name.

To clarify this further, the menu opens a page in a new iframe, which is a new page entirely.

I'm sure this is not making sense but I hope someone knows what I'm talking about. :)

 Tags:

   Report

2 ANSWERS


  1. here's how I would do it.

    <body>

    <iframe name="iframe1" href="http://yahoo.com"></iframe>

    <script>

    function reloadiframe()

    {

    iframe1.history.go(0)

    }

    </script>

    <body>

    Call reloadiframe() whenever you want to reload the iframe.


  2. Unless this is for acedemic reasons, I highly recommend NOT using iframes.  They do not get indexed by Google and you won't get credit for them.

    None the less, here is the code.

    <iframe name="frame_1"></iframe>

    <iframe name="frame_2"></iframe>

    <script>

    frames['frame_1'].location.href = 'home.html';

    </script>

    OR ...

    <a href='home.html' target="frame_2">Home</a>

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.