SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2005
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Get URL of iframe - external domain

    Is there ANY way to get the URL of an iframe if the page the user is on is an external domain? I know this is normally blocked by the "Same Origin Policy", but I'm just trying to find out if there is SOME workaround. All I'm trying to get is the URL.

    Any input would be much appreciated... thanks!

  2. #2
    SitePoint Enthusiast AvengeX's Avatar
    Join Date
    Oct 2005
    Location
    London, UK
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The first thing I would try is giving the iframe an ID. Assuming it's been ID'd "iframe", try this:

    Code:
    <script>alert(document.getElementById('iframe').src)</script>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •