Fix bypass for window.printOnLoad if onLoad undefined
Merge pull request #1957 from geoadmin/kan_improve_profile_fix

Fix bypass for window.printOnLoad if onLoad undefined