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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2003
    Location
    Bellingham, WA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool how to detect location of parent frameset from page?

    I have a site which is currently displaying within a frameset (cloaked forwarding of the domain by the domain registrar). For reasons which are too boring to go into, I need certain browsers to take the page out of the frameset to be viewed. (for testing, I'm using IE 5.1)

    I'm doing well with my browser detect (using a great script I found at http://www.dithered.com/javascript/browser_detect/index.html.), but I can't seem to detect whether the page is being displayed within a "parent" window. I've tried the script:

    if (window.parent.location.href == "http://www.skmotorsport.com")
    {window.parent.location.href = "http://www.skperf.com";}

    But it simply didn't work.

    I wondered whether I wasn't getting the parent window object properly addressed, so I made a simple test script that would tell me the parent window's URL:

    alert (window.parent.location.href);

    This didn't work either in the frameset context. But it DID work when I right-clicked and opened the frame in a new window.

    Bang! Up comes the alert message with the URL.

    So then I wondered whether it was because the frame the page was inside was being created by the domain registrar, whether that affected the script. So I created a frameset within my same domain, with the page inside that I'm hoping to "free."

    Voila! My alert script worked perfectly, displaying the URL of the page. (the redirect still doesn't, though)

    Is this a security issue? You can ONLY reference the frameset's attributes from a page inside it when the page and frameset are within the same domain? (the question at hand)

    Is there any other way to do this?

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Not too sure about this but it could be something like:


    if(IE)

    if (top.location.href.indexOf("frameset.htm") == -1){
    top.location.href = "frameset.htm"
    }
    else{
    top.location.href = "thispage.htm
    }

  • #3
    New to the CF scene
    Join Date
    Feb 2003
    Location
    Bellingham, WA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool can't access parent window's properties

    I heard from another forum that you cannot access the properties of a page in another domain (for security reasons). This seems to be the case, as all my scripting ideas work perfectly if I create a frameset in the same domain (skperf.com), but none of them function at all when I'm trying to detect the frameset properties in the parent domain (skmotorsport.com).


  •  

    Posting Permissions

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