Apparently, on webkit browsers, the onload event on a iframe triggers twice. Once when the iframe is created and then, when the src is set.
According to this answer : https://stackoverflow.com/a/15880489/3170216
You can prevent this behavior if you attach the onload event after your iframe element is appended to the body. But i'm not sure how to do that in your situation.