I am struggling to get parenet URL inside my iframe (ie the url showing in browser). My parent site is gslb13.aaa.com .Inside there is an iframe in which i am loading my site test.elasticbeanstalk.com
(notice both are in different domain)
Onclicking smile
link in gslb13.aaa.com
. It will load test.elasticbeanstalk.com
inside iframe.
To get the parent url I tried with
var url = (window.location != window.parent.location) ? document.referrer: document.location;
alert(url);
I am getting the parent URL in index page of test.elasticbeanstalk.com (on load). then:
1) I clicked "Add" buttons in the test.elasticbeanstalk.com to go to next view
2) Repeated the same code in add.jspx to get the same parent URL
But unfortunately I am getting the URL of test.elasticbeanstalk.com(Not Parent URL:gslb13.aaa.com )
Can Any one suggest me a way to handle this?
use
document.referrer;
Refer This
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With