You have set the src attribute (when doing a random image) of the iframe to:
Now, at least as far as I can tell, there is something about that page that generates its own unique id for itself when it loads or something like that, but however it is done, it is done after you set the iframe's src attribute. So querying the iframe's src attribute will only give you:
However, since the iframe's location has changed, this will give you what you are after:
Code:
window.frames[0].location.href
Example usage, replace:
Code:
onclick="alert(document.getElementById('DisplayFrame').src);"
with:
Code:
onclick="alert(window.frames[0].location.href);"
Notes: This will only work for pages on the same domain (not a problem with your demo pages, if the situation changes and you spread this out across more than one domain, there could be problems). The [0] refers to the first frame (in this case iframe) in the window. Iframe's locations must be queried of the iframe as a part of the window's frames collection, not as part of the document's elements collection.
An alternative would be to generate the random query string id on the top page instead, then set the src attribute of the iframe, with the page v1.php not generating a unique id for itself. Then you could query the iframe's src attribute and get an accurate report.
Bookmarks