diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 816ef46..f6beeb1 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -3,6 +3,8 @@ Yii Framework 2 Change Log 2.1.0 under development ----------------------- + +- Enh #11058: Add `$checkAjax` parameter to method `yii\web\Controller::redirect()` which controls redirection in AJAX and PJAX requests (ivanovyordan) - Enh #12592: Optimized `yii\filters\AccessController` on processing accessrules (dynasource) - Removed methods marked as deprected in 2.0.x (samdark) - Chg #10771: Consistent behavior of `run()` method in all framework widgets. All return the result now for better extensibility (pkirill99, cebe) @@ -86,7 +88,6 @@ Yii Framework 2 Change Log - Enh #12580: Make `yii.js` comply with strict and non-strict javascript mode to allow concatenation with external code (mikehaertl) - Enh: Method `yii\console\controllers\AssetController::getAssetManager()` automatically enables `yii\web\AssetManager::forceCopy` in case it is not explicitly specified (pana1990, klimov-paul) - 2.0.9 July 11, 2016 ------------------- diff --git a/framework/web/Controller.php b/framework/web/Controller.php index 3668f37..4d93e25 100644 --- a/framework/web/Controller.php +++ b/framework/web/Controller.php @@ -111,7 +111,7 @@ class Controller extends \yii\base\Controller } return true; } - + return false; } @@ -139,11 +139,17 @@ class Controller extends \yii\base\Controller * @param integer $statusCode the HTTP status code. Defaults to 302. * See * for details about HTTP status code + * + * @param boolean $checkAjax whether to specially handle AJAX (and PJAX) requests. Defaults to false, + * meaning a `Location` header will be sent, which when received as an AJAX/PJAX response, may NOT cause + * browser redirection. If this is true, the current request is an AJAX or PJAX request, then calling this method + * will cause the browser to redirect to the given URL. + * Takes effect only when request header `X-Ie-Redirect-Compatibility` is absent. * @return Response the current response object */ - public function redirect($url, $statusCode = 302) + public function redirect($url, $statusCode = 302, $checkAjax = true) { - return Yii::$app->getResponse()->redirect(Url::to($url), $statusCode); + return Yii::$app->getResponse()->redirect(Url::to($url), $statusCode, $checkAjax); } /**