EDIT:- Full jQuery solution
<iframe id="settings-iframe" name="settings-iframe"></iframe>
$(document).ready(function() {
$('iframe#settings-iframe').on('load', function() {
// var location = this.contentWindow.location.href;
var location = this.contentWindow.location.href.substr(this.contentWindow.location.href.lastIndexOf("https://stackoverflow.com/")+1);
console.log('location : ', location);
switch (location) {
case "https://stackoverflow.com/questions/44771951/iframe-home.php":
console.log(location);
activateHome();
break;
case "changepassword.php":
console.log(location);
activatePassword();
break;
case "update.php":
console.log(location);
activateName();
break;
}
});
});
OLD:
Try this :-
var $location = this.contentWindow.location
6
solved Upon Redirect of Form Submission within iFrame jQuery Not Detecting Updated Src Attribute