iframe call parent function code example
Example 1: how to access parent function from iframe
document.getElementById('targetFrame').contentWindow.targetFunction();
Example 2: iframe parent url
var url = (window.location != window.parent.location)
? document.referrer
: document.location.href;