Solution to browser reporting Mixed Content error:

In the https address, if an http resource is loaded, the browser will consider it an unsafe resource and will block it by default, which will bring you problems of incomplete resources, such as: pictures cannot be displayed, styles cannot be loaded, JS Could not load.

The console reports an error:

Mixed content: load all resources via HTTPS to improve the security of your site
console error
console error

solution:

The first

  1. First make sure that the imported resources can be accessed under both http and https
  https://xxx.com/index.php/Index/index.html
  http://xxxx.hyaomall.com/index.php/Index/index.html
  1. Write a form similar to a relative path in the head
<script src="//xxx.com/js/jquery-1.6.0.js" type="text/javascript"></script>

the second

  1. Add upgrade-insecure-requests to the (meta) header in the page
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
  1. This will convert http requests to https requests. In this way, the Mixed Content error will no longer appear.

I use the second

Guess you like

Origin blog.csdn.net/Depressiom/article/details/128835041