Use document.referrer instead of invalid window.parent