Remove #! In the URL


Is there a way to get rid of the #! in the URL of the views?

It depends.

Vaadin uses the so-called “hashbang” URIs because historically, the fragment is the only part of the URI that can be changed via JavaScript without triggering a page reload. The “bang” (!) is used to make such URIs crawlable by search engines (please refer to
this document
for more info).

Now, you can fairly easily get rid of the exclamation mark - you can inherit Navigator.UriFragmentManager and override the getState() and setState() methods, then pass an instance of your custom UriFragmentManager to the relevant Navigator constructor.

Eliminating the # is trickier. First off, it’s only possible with browsers supporting the HTML5 pushState API - this rules out IE8 and IE9. Second, it requires you to implement the JavaScript pushState part manually; this is probably easiest to do using a custom JavaScriptExtension.

a ticket
for adding a “hashless” navigation support to Vaadin; I actually have written a prototype implementation, so it might be possible to see this functionality in Vaadin 7.2.

For those who still look for an answer:
Add @PushStateNavigation to your UI.