The example in this article describes the method of using js to implement ifram to obtain the URL address of the parent window. Share it with everyone for your reference. The specific implementation method is as follows:
var url=''; try { url = window.top.document.referrer ; } catch(M) { if (window.parent) { try { url = window.parent.document.referrer; } catch(L) { url = ""; } } } if (url === "") { url = document.referrer; }
The above code has been executed in the browser and the address can be obtained.
I hope this article will be helpful to everyone’s JavaScript programming design.