1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

HTML iframe issue

Discussion in 'Web Development' started by jd132, Feb 11, 2011.

  1. jd132

    jd132 VIP Member

    how to open a link outside the iframe to the main window

    i used iframe to display some content inside a page and inside the iframe im having some links which onclick i want to take to section (kinda <a name=""> tag) on the main window i've tried target="_top" but not got the result anyone got any solution for tht :)

    cheers!!

    JD
     
  2. Mimoun

    Mimoun Administrator Staff Member Director Verified Member

    I would try to avoid using iframes, but if you have to try target="_parent".
     
  3. jd132

    jd132 VIP Member

    thanks buddy i've tried but same problem :(

    but i sorted tht out i used scroll bar (overflow-x: visible) and display the content inside the sliding div now it's working fine :)
     
  4. Mimoun

    Mimoun Administrator Staff Member Director Verified Member

    I forgot to add that you need to add some javascript to make the target work. This is only for inline frames not normal frames.

    The code for your iframe page:
    Code:
    <html>
    <head>
        <title>iframe page</title>
        <script type="text/javascript"><!--
            document=parent.document;
    //--></script>
    </head>
    
    <body>
    <a href="http://www.example.com" target="_parent">link open in parent</a>
    </body>
    </html>
    But again try not to use frames if you can.
     
  5. jd132

    jd132 VIP Member

    cool tht will be helpful :)

    yeah i always try to avoid frames but structure is bit complicated as for outer frame they were using mootools script and for scroller they were using jquery so there was scripts clashing so i suggested for iframe.

    but finally got the solution and as soon as the site is live i will share the link here.
     
  6. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    mootools & jquery or mix any others have a tendency to not play well together.
    it's always best to pick one and go with it.
     
  7. jd132

    jd132 VIP Member

    yeah i know but someone else done the development im just fixing the mess :D
     
  8. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    There is nothing I hate more in programming then Fixing The Mess...
     
  9. jd132

    jd132 VIP Member

    lol yeah me too coz they pay more to fix ;)
     
  10. Chef Boy

    Chef Boy New Member

    What is the reason for avoiding iframes? I'm not to familiar with the subject, but I've found them kind of useful