i have iframe with src like /
, and when ever the src is get changed i need to trigger a function like iframeSrcChanged()
<iframe id="iframe" src="/" frameborder="0" width="100%" height="100%" ></iframe>
and when user click about-us inside iframe, the iframe src get changed into
<iframe id="iframe" src=".html" frameborder="0" width="100%" height="100%" ></iframe>
so this time i need to trigger iframeSrcChanged()
function.
Please help me to trigger out this issue.
i have iframe with src like http://remote-domain./
, and when ever the src is get changed i need to trigger a function like iframeSrcChanged()
<iframe id="iframe" src="http://remote-domain./" frameborder="0" width="100%" height="100%" ></iframe>
and when user click about-us inside iframe, the iframe src get changed into
<iframe id="iframe" src="http://remote-domain./about-us.html" frameborder="0" width="100%" height="100%" ></iframe>
so this time i need to trigger iframeSrcChanged()
function.
Please help me to trigger out this issue.
Share Improve this question asked Oct 21, 2013 at 15:33 rkaartikeyanrkaartikeyan 2,0079 gold badges30 silver badges57 bronze badges 1- Please see stackoverflow./questions/2429045/… – Tsanyo Tsanev Commented Oct 21, 2013 at 15:41
1 Answer
Reset to default 2var iframe = document.getElementById("iframe");
iframe.addEventListener("DOMAttrModified", function(event) {
if (event.attrName == "src") {
// The "src" attribute changed
}
});
However this will work only in modern browsers