Jquery – Getting the current src of an Iframe using JQuery

iframejquery

I need to get notified whenever a user clicks a link on a page in an iframe that is not from the same domain. I'm aware of xss restrictions, however all i need to know is the current page being served in the Iframe. Is there a way to do this without violating xss rules?

Best Answer

To get the iframe location using jQuery:

alert( $('iframeId').contents().get(0).location.href );