0

We are building an educational tool whereby students opens a website in another tab/window and then searches around the other site. Once finding the information they enter the url of the page they were on into a box. Its a bit clunky and what we want to do is allow them to open the new site (bbc.co.uk for example) within an iframe that has a header at the top allowing htem to return to their workbook.

When they navigate around the BBC site, we would like for them to be able to click a button on our frame which grabs what url they are on and some other info like page header etc and insert that automatically into their workbook.

However I cant seem to find how to grab the url of the page being viewed within the iframe. As we send them to bbc, I can get the source id easily enough but as soon as they start moving around the bbc site doing their research there is no way for the parent iframe (on our domain) to see what page they are on?

I know this is not possible in JS due to XSS issues, but was wondering if there is a workaround. Or any other way to grab the url. Currently our way of doing things is clunky, we want to make the tool a lot more easier.

Thanks Paul

Paul M
  • 3,937
  • 9
  • 45
  • 53
  • 1
    you only can do it with javascript. php is all server side. – Daniel A. White Mar 25 '15 at 11:53
  • I think this is your answer: http://stackoverflow.com/questions/938180/get-current-url-from-iframe. The only way to actually do it is if you server as the proxy and you remember who requested the content and then when someone clicks the button you serve up the url – in need of help Mar 25 '15 at 13:49

0 Answers0