Make func used to write iframe configurable... mostly for Qunit testing
Added tests