vaadinvaadin7

Changing page title (browser tab) dynamically in vaadin 7


I know in Vaadin 14 I can use the @PageTitle annotation (among other things) to change the title displayed in the browser tab on navigation changes - I got this to work when I was trying to upgrade my Vaadin 7 application. I also know that in Vaadin 7, I can use the @Title annotation to change the UI title. Is there a way in Vaadin 7 to do something similar to what we can do with @PageTitle in Vaadin 14? I just tried setting the title for a given View using @Title, and it did not work.

According to this posting, I can do it using something like Page.getCurrent().setTitle("title");, and this seems to work for Vaadin 7, but I want to confirm this is the best way.


Solution

  • Page.getCurrent().setTitle("title"); is the way to go.