Only add history entry after page has actually loaded

This prevents:
- History entry for pages that error out
- History view 'flickering' when you go from history to elsewhere

Change-Id: If55afc48a8179d4123f62734f0251228f1b74921