demos: Support back/forward navigation

Listen for the onhashchange event so that one can use the browser's
native Back and Forward navigation.

Change-Id: I490dda2d826327adf29da2ffaef3122f406c6995