Change the title on browser tab

[color=#333333][font=sans-serif][size=2]I am looking for a way to change the title that shows up on the browser tab on our website. like [/size][/font][/color][font="sans-serif"][color="#333333"][size=2]http://localhost/~user/demo/web/index.php?r=site into InvoiceMangement. is it possible in yii2 ? [/size][/color][/font]

thanks :)

Of course is it possible.


Between the <head></head> tags.

// change $this->title to whatever you want as title

<title><?= Html::encode($this->title) ?></title>


In the view file you’ll see something like :

$this->title = 'About';

This sets the browser windows title (or tab title) to ‘About’.



thank guys it worked :)

If you need the name of the app to be there (and just change the second part of the title, so the action name):

In your controller (override the setPageTitle method):

public function setPageTitle($value){

		$this->pageTitle=Yii::app()->name." - ".$value;


and then set the title in each Action, example:

public function actionCreate()


		$this->pageTitle = "New Title";




The result will be:

App Name - New Title