在Chrome中,有多少重定向"太多"?

Aks*_*hat 50 webkit google-chrome

通常,当脚本有重定向循环时,我们会在Google Chrome中收到错误消息

错误310(net :: ERR_TOO_MANY_REDIRECTS):重定向太多.

有多少重定向太多了?

Den*_*nis 60

谷歌Chrome 17.0.963.56允许最多20个重定向,使用此PHP脚本测试:

<?php
    $redirect = (isset($_GET['redirect'])) ? $_GET['redirect'] : 0;
    header("Location: redirects.php?redirect=" . ($redirect + 1));
?>
Run Code Online (Sandbox Code Playgroud)

310尝试打开时redirects.php?redirect=21,Chrome会中止错误,这意味着首次20重定向成功.


Pan*_*al. 38

在Win 7 64bit上测试

  • Chrome 64bit Version: 49 78.0.3904.87 (Official Build),19重定向
  • Chrome Canary版32位,Version: 49 79.0.3922.0 (Official Build),19个重定向
  • Firefox 32位 version: 43 66.0.3,20次重定向
  • Firefox 64位 version: 43 69.0.1,20次重定向
  • Opera 67.0.4, version: 28 19重定向
  • Safari 63.0.3368.94,16个重定向
  • IE version: 5.1.7 11 通过webpagetest.org重定向
  • IE version: 8 121 通过webpagetest.org重定向
  • IE version: 9 121 通过webpagetest.org重定向
  • IE version: 10 110重定向
  • Microsoft Edge version: 11.48.17134.0 20重定向
  • 谷歌Nexus 5,三星Galaxy S4⇄S9,Galaxy Tab的4,19个重定向