Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT: how can I change browser tab name?

I know that to change the name of the tab in which browser opens the site I need to to change the title tag in the html file.

But in GWT the things are a bit different: each new place uses the same html file, so the browser tab's name will be the same for all the places.

  1. How can I specify a name for each of my places?
  2. This idea above do not work in IE 9. In IE 9 I see www.my-site.com/#my-place-name: name of the browser tab displayed instead of the contents of title tag. How can I make it work for IE too?
like image 847
KutaBeach Avatar asked Dec 03 '12 10:12

KutaBeach


People also ask

What is the title of a browser tab?

The title tag is an element of your webpage's header that defines the title of a webpage that is used in your browser's tab, favorite links, social sharing previews, and most importantly on search engine results pages (SERPs).


2 Answers

You can alter the title of the page with the following code

Window.setTitle("My Place Name");

Do notice that the place who call this the latest will set its title.

like image 177
David Avatar answered Oct 15 '22 21:10

David


You can change the page title (e.g "Tab Name") by a call to a static function in GWT:

import com.google.gwt.dom.client.Document;
...
public static void setBrowserWindowTitle (String newTitle) {
    if (Document.get() != null) {
        Document.get().setTitle (newTitle);
    }
}
like image 21
Engineer2021 Avatar answered Oct 15 '22 21:10

Engineer2021