overcome the bug where iframe has a undefined contentDocument