Change the canvas dimension on screen rotation

example does work without need to refresh. Maybe you have something different in html or css that is interfering with scale of game. Maybe this issue is the problem.

Check this post as well.