Possible to show an iframe's current location (current URL)

Discussion in 'Javascript' started by liketofindoutwhy@gmail.com, Mar 19, 2008.

  1. Guest

    Let's say if I do an iframe... is it possible to show the current
    location (current URL) of that iframe on the parent page if it has
    navigated outside of my domain? (that is... if i iframe and set the
    src to www.mywebsite.com, it seems that i can show the current URL of
    that iframe as long as the user is navigating within mywebsite.com.
    Once the user navigate outside of it, then i cannot show the iframe's
    current location using

    document.getElementById("an_iframe").contentWindow.location
    or document.getElementById("an_iframe").contentWindow.location.href

    hm... that's a bit strange, because it is just a URL.... and if i
    navigate in the main browser window, the URL is always visible in the
    browser's address bar, so why is there any security issue about it?)
    , Mar 19, 2008
    #1
    1. Advertising

  2. wrote:
    > [...]
    > Once the user navigate outside of it, then i cannot show the iframe's
    > current location using
    >
    > document.getElementById("an_iframe").contentWindow.location


    WFM in Firefox 2.0.0.12.

    > or document.getElementById("an_iframe").contentWindow.location.href


    That is not supposed to work in your situation because the `href' property
    of Location objects is tainted by default as per JavaScript 1.3 and
    therefore it is subject to the Same Origin Policy.

    http://docs.sun.com/source/816-6408-10/location.htm#1193550


    PointedEars
    --
    Use any version of Microsoft Frontpage to create your site.
    (This won't prevent people from viewing your source, but no one
    will want to steal it.)
    -- from <http://www.vortex-webdesign.com/help/hidesource.htm>
    Thomas 'PointedEars' Lahn, Mar 19, 2008
    #2
    1. Advertising

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. Mr. x
    Replies:
    2
    Views:
    3,480
    Mr. x
    Nov 29, 2003
  2. Daedalous
    Replies:
    3
    Views:
    663
    Daedalous
    Jan 16, 2004
  3. Jack
    Replies:
    3
    Views:
    583
    Tad J McClellan
    Dec 22, 2008
  4. Replies:
    2
    Views:
    91
  5. Alex Bird
    Replies:
    3
    Views:
    169
    Thomas 'PointedEars' Lahn
    May 9, 2008
Loading...

Share This Page