I will need to call child url from parent url. Both are having different host . test.html is stored in the server, www.web1.com will load test.html and display this on www.prod.com
I am trying to capture the url that is showing from website1[www.web1.com] on website2[www.prod.com]
Flow is as shown below
inside test.html , i have used console.log(window.top.location.href) , this will display "www.web1.com" on my console.log
on www.prod.com , it will load www.web1.com which consist of test.html , when window.top.location.href script that was declared in test.html and place in web 1 is loaded in website 2, this will cause DOMException cross origin error because the script is reading www.prod.com instead of www.web1.com. I have read through some source to use document.referrer , i am wondering if this is possible for web 2 to display "www.web1.com" on console.log when it loads web 1 on web 2
ideally , if we use window.location, this will load the top url of web ,
But as for the usecase i stated above, web2 should load and display web1 url on web2 console.log