gwturl-rewritinggwt2gwt-history

History: avoiding hash ("#") character in URLs


We are using GWT and take advantage of History framework. Everything works fine in application, but some of our clients are trying to put hyperlinks to our application in their PowerPoint presentations. But there is known problem in PP2007 with hash signs ("#") in hyperlinks which makes them unusable.

So is there any way to change separator character used in URLs generated by GWT Hisory framework to something other than hash?

Or is it possible to intercept new URL generated by GWT history and modify it before browser's adress bar is updated with it?


Solution

  • I don't think you can/should change the hash sign. Mainly because this sign does not come from GWT but from HTTP specifications. You can read the part on hash fragments in this doc for a good explanation. The main point being that adding a # sign to a url will not cause a full browser refresh. This is why this sign is used for ajax and GWT's history.

    If you still want to intercept new URLs, you should probably add a ValueChangeHandler to your History, and then use Window.Location.getHref() and Window.Location.assign() to change the URL. But that's like using History to do something it doesn't do, so you're better off implementing your own History management system.