Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Nov 2003
    Location
    Toronto
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    retreving the pages name from a iframe

    Hi,

    is it possible for me to get the main pages name from within a IFRAME?

    If so, how and is it cross browser safe technique?
    ~Salman
    c# community

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If it is in the same domain then I believe you could use parent.document.title to grab the title of the main page and parent.location.href to get the document. I have not tested this so I can't say for sure.

  • #3
    New to the CF scene
    Join Date
    Nov 2003
    Location
    Toronto
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i need it to work for same and different domain..not possible?
    ~Salman
    c# community

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Due to security restrictions you cannot grab the info for a page that is in another domain.

  • #5
    New to the CF scene
    Join Date
    Nov 2003
    Location
    Toronto
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Would this be possible.

    Domain#1 creates a javascript section on every page, and creates a variable that holds the name of the current page.


    Then, in the IFRAME (from another domain possibly) it simply looks for that variable, if it exists, then use that since it contains the URL of the main page.

    Is that a clean solution?
    ~Salman
    c# community

  • #6
    New to the CF scene
    Join Date
    Nov 2003
    Location
    Toronto
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How can I check if the parent page has a Varialbe created?

    Thanks!
    ~Salman
    c# community

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    As has been said, you cannot grab data from another domain. You will get an access denied error.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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