public function goBack($defaultUrl = null)
    {
        return $this->app->getResponse()->redirect($this->app->getUser()->getReturnUrl($defaultUrl));
    }
public function goBack($defaultUrl = null)
    {
        return $this->app->getResponse()->redirect($this->app->getUser()->getReturnUrl($defaultUrl));
    }
public function goBack ( $ defaultUrl = null ) { return $ this -> app -> getResponse ( ) -> redirect ( $ this -> app -> getUser ( ) -> getReturnUrl ( $ defaultUrl ) ) ; }
Redirects the browser to the last visited page.

You can use this method in an action by returning the [[Response]] directly:

```php
// stop executing this action and redirect to last visited page
return $this->goBack();
```

For this function to work you have to [[User::setReturnUrl()|set the return URL]] in appropriate places before.

@param string|array $defaultUrl the default return URL in case it was not set previously.
If this is null and the return URL was not set previously, [[Application::homeUrl]] will be redirected to.
Please refer to [[User::setReturnUrl()]] on accepted format of the URL.
@return Response the current response object
@see User::getReturnUrl()
Redirects the browser to the last visited page .