正如9 月宣布的那样,Chrome 很快就会在网址栏中将包含密码和信用卡输入字段的不安全网页标记为不安全。
本文档旨在帮助 Web 开发者更新其网站,以避免出现此警告。
启用警告
在 Chrome 56 中,系统将默认为所有用户启用警告功能,该版本预计将于 2017 年 1 月发布。
如需在该时间之前测试即将推出的用户体验,请安装最新的 Google Chrome Canary build。
若要将 Chrome 配置为在 2017 年 1 月显示警告,请打开 chrome://flags/#mark-non-secure-as
并将 Mark non-secure origins as
non-secure
选项设置为 Display a verbose state when password or credit card
fields are detected on an HTTP page
。然后重新启动浏览器。
您可以在此页面上查看浏览器警告行为示例。
显示“不安全”状态时,开发者工具控制台会显示消息 This
page includes a password or credit card input in a non-secure context. A warning
has been added to the URL bar.

解决警告
为确保您的网页不会显示“不安全”警告,您必须确保包含 <input type=password>
元素的所有表单以及被检测为信用卡字段的所有输入内容仅出现在安全来源中。这意味着顶级页面必须采用 HTTPS 协议,如果 input
位于 iframe 中,则该 iframe 也必须通过 HTTPS 提供。
如果您的网站在 HTTP 网页上叠加 HTTPS 登录框架,请执行以下操作:

您需要更改网站,使其为整个网站使用 HTTPS(理想),或者将浏览器窗口重定向到包含登录表单的 HTTPS 网页:

长期 - 在所有位置使用 HTTPS
最终,Chrome 会对通过 HTTP 提供的所有网页显示“不安全”警告,无论相应网页是否包含敏感输入字段。即使您采用了上述更具针对性的解决方案之一,也应计划迁移您的网站,以便所有网页都使用 HTTPS。