如果我强制使用http,https图像不会显示 [英] https image does'nt displayed if I force in http

查看:494
本文介绍了如果我强制使用http,https图像不会显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的代码中,我强制图像加载http。但是,托管其图片的某些用户也使用https获取图片,因为它们托管在安全服务器上,并且突然显示在我的网站上。如何显示它们,而无需更改应用程序的源代码
默认情况下,当我显示图像时:

  < img src =http://  - 没有http或https的图片的HERE网址 - > 


解决方案

您需要使用用户提供的协议。

他们可以在http和https上托管不同的内容。你无法知道它。



协议是uri的一部分,就像域或路径一样。你不能为其他人决定。



唯一的问题是如果你的网站使用https:你不能包含没有混合内容问题的http图像。


In my code, I force the images to load http. However some users hosting their images also get images with https because they are hosted on secure servers and suddenly, they are not displayed on my site. How to display them, without changing my source code of the application By default, when I display an image :

<img src="http://-HERE url of the image without http or https-">

解决方案

You need to use the protocol provided by the user.

They can host different content on http and https. You can't know it.

The protocol is part of the uri, like the domain or the path. You can't decide it for others.

The only problem is if your website use https: you can't include http images without mixed-content issues.

这篇关于如果我强制使用http,https图像不会显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆