Some of the above method like setContent & open are either async or too slow for this to work otherwise... for me at least.