Jump to content


Photo

Get the current URL of an iframe


  • Please log in to reply
1 reply to this topic

#1 Randy

Randy
  • Members
  • PipPip
  • Member
  • 25 posts
  • LocationNewcastle, UK

Posted 02 August 2006 - 05:03 PM

I was wondering how I would get the current url of an iframe, I have searched on google but all to no avail.

#2 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 02 August 2006 - 05:44 PM

let's say the iframe id is "frm" you can access the URL by
document.getElementById('frm').contentWindow.location.href

This only works if all the pages are on the same domain.

NoGray.com





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users