【问题标题】:CSS/Stylish gives HTTP/HTTPS error in background: url()?CSS/Stylish 在后台给出 HTTP/HTTPS 错误:url()?
【发布时间】:2016-02-25 02:16:56
【问题描述】:

我收到了这个错误:

https://www.google.com/”处的页面是通过 HTTPS 加载的,但是 请求了不安全的图像“http://i.imgur.com/#####.png”。这 内容也应该通过 HTTPS 提供。

我该如何解决这个问题?
我的时尚代码:

#hplogo {
    /* these numbers match the new image's dimensions */
    padding-left: 125px !important;
    padding-top: 25px !important;
    background: url(http://i.imgur.com/cr5pCeF.png) no-repeat !important;
}

【问题讨论】:

  • 只需将http 更改为https。这应该有效。

标签: css google-chrome firefox stylish


【解决方案1】:

如果您从不安全 (http) 页面请求“安全”(https) 图像,浏览器不会抱怨1

所以只需使用background: url(https://i.imgur.com/cr5pCeF.png) no-repeat !important;

1 在您的情况下,无论如何,Google 都会自动从 http 重定向到 https,因此不会出现不匹配的情况。


此外,对于 Chrome 上的 Stylish,您可以使用 URL 的自动协议形式。那就是:

background: url(//i.imgur.com/cr5pCeF.png) no-repeat !important;

但是,不幸的是,Firefox 尚不支持此功能。所以不要在跨浏览器的 Stylish 脚本中使用它。

【讨论】:

  • 谢谢!另外,我可以删除时尚的图像吗? (必须带有 标签)
  • 既然这似乎已经回答了您的问题,请tick the benchmark for this answer。 .. 而且,不,您不能使用 Stylish 删除图像,但您可以设置 display: none !important;
猜你喜欢
  • 2015-10-04
  • 2017-01-10
  • 2014-12-15
  • 1970-01-01
  • 2014-05-06
  • 1970-01-01
  • 2021-03-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多