Maintain history state object when changing pages

This is required for history-management libraries like jquery-pjax which uses the state object to load pages via AJAX.
Merge pull request #169 from longzheng/patch-1

Maintain history state object when changing pages