Thursday, February 6, 2014

Javascript function to get parent URL

This is usefull in case of finding parent URL from iframe or a popup etc.,

function getParentUrl() {
    var isInIframe = (parent !== window),
        parentUrl = null;

    if (isInIframe) {
        parentUrl = document.referrer;
    }

    return parentUrl;
}

No comments:

Post a Comment