SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Detect parent window URL from iFrame?

    Hello, I am trying to find out how I can detect the current url of the parent window from an iframe. I would like to have a statement that does something if the parent window URL is "/story.php?title=anyparameter", so as long as url is story.php regardless of any parameters that follows it would execute another function.

    Any help on this would be greatly appreciated!

  2. #2
    SitePoint Evangelist hexburner's Avatar
    Join Date
    Jan 2007
    Location
    Belgium
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code JavaScript:
    function checkPage() {
        var requestedFilename = window.parent.location.href.split(document.domain)[1].split('?')[0];
        alert(requestedFilename);
    }
    FOR SALE: 1 set of morals, never used, will sell cheap


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
  •