iframe issue with html/javascript

Discussion in 'Javascript' started by dmalhotr2001, Oct 14, 2009.

  1. dmalhotr2001

    dmalhotr2001 Guest

    I have a header and a footer iframe inside a page. What I would like
    to do is when i click on a link inside either of the iframe, that it
    open up inside the main page rather than the iframe itself. Is there
    a way to do that?

    Thanks

    :D
     
    dmalhotr2001, Oct 14, 2009
    #1
    1. Advertisements

  2. Stefan Weiss wrote:

    > On 14/10/09 02:54, dmalhotr2001 wrote:
    >> I have a header and a footer iframe inside a page. What I would like
    >> to do is when i click on a link inside either of the iframe, that it
    >> open up inside the main page rather than the iframe itself. Is there
    >> a way to do that?

    >
    > from HTML: <a ... target="_parent"
    > from JS: window.parent.location.href = ...


    To work around the SOP, only

    window.parent.location = ...

    as the `href' property is tainted. Scripting should be avoided here,
    though.

    > Header and footer iframes? I don't know what kind of page you're working
    > on, but a server-side solution may work better for you (and your
    > visitors).


    And/or block-level elements positioned fixed with CSS (and IE 6 workaround),
    in which case none of the above would be necessary.


    PointedEars
    --
    Prototype.js was written by people who don't know javascript for people
    who don't know javascript. People who don't know javascript are not
    the best source of advice on designing systems that use javascript.
    -- Richard Cornford, cljs, <f806at$ail$1$>
     
    Thomas 'PointedEars' Lahn, Oct 14, 2009
    #2
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daedalous
    Replies:
    3
    Views:
    863
    Daedalous
    Jan 16, 2004
  2. Robert Oschler
    Replies:
    2
    Views:
    155
    Robert Oschler
    Aug 3, 2005
  3. chasquad
    Replies:
    0
    Views:
    114
    chasquad
    Feb 13, 2006
  4. plex4r
    Replies:
    0
    Views:
    135
    plex4r
    Mar 9, 2006
  5. Replies:
    2
    Views:
    156
Loading...

Share This Page