4

I have an iframe. When the page loads, the page makes a queryString.

I need to access the query string that is generated after the page is loaded

But with this code just I can access the src without the query string

alert(document.getElementById('myframe').src);
2
  • see stackoverflow.com/questions/729577/… Commented Nov 19, 2014 at 12:35
  • my parent url : localhost/web_social and my iframe url : localhost:8585/something Commented Nov 19, 2014 at 12:41

1 Answer 1

1

Try:

document.getElementById("myframe").contentWindow.location.href

where myframe is the id of the frame

Sign up to request clarification or add additional context in comments.

2 Comments

get this errror in console : Uncaught TypeError: Cannot read property 'myframe' of undefined htmlpage.html:121getiframeURL htmlpage.html:121onclick htmlpage.html:130 screanshot : xum.ir/image/bLMC
works for me, try this: alert(document.getElementsByTagName('iframe')[0].contentWindow.location.href);

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.