Added support for configure option html5history and related browser side
implementation. With this option routing can use pretty URIs instead of
the hash URIs. It's worth to notice that switching the method most
likely requires changes also to backend since the browser will, upon
initial page load, ask for the URI it is loading instead of the service
index (e.g. yourhost.com/users/1).
There is a bug in Chrome which causes it to trigger onpopstate event
when performing initial page load. Since the event handler must be
called upon init manually to ensure correct content, the bug would cause
two handler calls in Chrome. Now the handler is set in a setTimeout in
order to avoid (most) double calls in Chrome.
See Chrome bug for reference:
In some cases, like when you get an URL from an IE user, page can be entered with a hash URL. This commit changes the functionality so that the hash is checked regardless of operation mode, and if in HTML5 history mode the current history state is replaced and handler is called with a nice, clean URI.
By default when in html5history mode the route handler is executed in Router.init() because of need for routing cannot be determined (like it easily can when using hashes). Usually this is the wanted behavior, but since that is not always the case this option makes it possible to disable execution.