JavaScript getting the URL in browser from an iframe
I am using a free site. that free site has a free app. In that free app I can run PHP code from my server.
What JavaScript code can get me the URL of the address showing in browser called from an iframe on my server?
Thanks开发者_运维技巧 -Ed
If I understand you right, you want to get the URL of the main window from the iframe. If so (from the page in the iframe):
window.parent.location.href
NB: Security policies on browsers will not allow you to access the this property if the main window and the iframe are accessed on different domains.
var addressBarURL = top.location.href;
精彩评论