Fix Uncaught TypeError when accessing window

Use message passing instead of directly accessing parent window
Relay pushstate and popstate actions between windows