Https的站点不请求htpp资源问题

最近在做一个项目。涉及到音频播放,可是当访问的站点是http的时候,可以请求到mp3资源,如图:
图片描述

可是当站点换成https的时候,却请求不到对应的mp3资源,如图:

图片描述

还望看见的小伙伴能够解答一下,谢谢了

阅读 4.8k
2 个回答

浏览器默认是不允许https网站引入http资源的,你需要把音频文件的域名也改成https

浏览器不允许HTTPS页面加载HTTP资源,因为不安全,这里引用一个Google的What Is Mixed Content?

Mixed content occurs when initial HTML is loaded over a secure HTTPS connection, but other resources (such as images, videos, stylesheets, scripts) are loaded over an insecure HTTP connection. This is called mixed content because both HTTP and HTTPS content are being loaded to display the same page, and the initial request was secure over HTTPS. Modern browsers display warnings about this type of content to indicate to the user that this page contains insecure resources.

在HTTPS页面加载HTTPS资源会有以下报警信息:

图片描述

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题