I wonder if I could learn the url inside iframe even if user clicks another link. To clarify; imagine that I have iframed stackoverflow.com and you visited that page. Then you decided to click Ask Question button while you are still inside iframe. Could I track your steps?
Thank you!
You can't. The Same Origin Policy prevents any and all access to the iframe, so you can't attach any listeners to the iframed document.
Plus in the specific instance of Stack Overflow, the site has a Frame buster mechanism and won't allow to be embedded in an iframe.
you can get the initial URL of the frame though
document.getElementById('elementid').src