jQuery - Get URL of iframe AFTER redirection on same domain

16,849

The suggestion from sunn0 should work with this slight amendment.

 $("#iframeid").load(function(){
    alert(this.contentWindow.location);
 });
Share:
16,849

Related videos on Youtube

Matthew H
Author by

Matthew H

Updated on May 03, 2022

Comments

  • Matthew H
    Matthew H almost 2 years

    Using Jquery, how can I get the URL of an iframe after redirection has occurred to a URL in the same domain?

    • Pekka
      Pekka over 13 years
      What kind of redirection? Where is the jQuery instance running?
  • Fenton
    Fenton over 10 years
    @confiq are you loading a page on the same domain in the iframe? You can only inspect the location on the same domain.
  • confiq
    confiq over 10 years
    Yeah, I've figure out that I can't access .location property if it's not same domain/port.