Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iframe contents change event?

Tags:

jquery

iframe

How can I detect when the iframe content has changed and do something upon that change pseudo code below

 $('#waframe').contents().change(function(){    //do stuff   }); 
like image 304
mcgrailm Avatar asked Mar 12 '10 16:03

mcgrailm


1 Answers

Well, the browser seems to generate a "load" event on an <iframe> element in the context of the containing page. The "load" fires when the "src" is changed; not sure whether it fires when the iframe changes itself.

edit: yes it does seem to fire when the page reloads "internally"

Thus you might try:

$('iframe#yourId').load(function() {   alert("the iframe has been loaded"); }); 
like image 137
Pointy Avatar answered Oct 12 '22 21:10

Pointy