uniapp小程序https页面嵌套http的H5页面问题笔记

一、错误信息

This request has been blocked; the content must be served over HTTPS.

二、解决方法

html 复制代码
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

三、解决过程

1、在根目录下新建template.html

html 复制代码
<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
		<title>
			<%= htmlWebpackPlugin.options.title %>
		</title>
		<!-- Open Graph data -->
		<!-- <meta property="og:title" content="Title Here" /> -->
		<!-- <meta property="og:url" content="http://www.example.com/" /> -->
		<!-- <meta property="og:image" content="http://example.com/image.jpg" /> -->
		<!-- <meta property="og:description" content="Description Here" /> -->
		<script>
			var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
			document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
		</script>
		<link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
	</head>
	<body>
		<noscript>
			<strong>Please enable JavaScript to continue.</strong>
		</noscript>
		<div id="app"></div>
		<!-- built files will be auto injected -->
	</body>
</html>

2、在manifest.json中配置

javascript 复制代码
"h5" : {
        "router" : {
            "mode" : "hash",
            "base" : "/jidian/."
        },
        "title" : "自助祭奠",
        "template" : "template.html"
    }
相关推荐
qq_3667406017 分钟前
ubuntu+ros新手笔记(五):初探anaconda+cuda+pytorch
pytorch·笔记·ubuntu
coder_Alaric2 小时前
[笔记]Qt下使用SendMessage、PostMessage和接收window消息
笔记·qt
LuckyLay3 小时前
Golang学习笔记_11——指针
笔记·学习·golang·指针
红色的山茶花3 小时前
YOLOv9-0.1部分代码阅读笔记-common.py
笔记
Allen_LVyingbo3 小时前
基于贝叶斯优化LightGBM模型对医院防火隐患区域火灾风险预测
笔记·健康医疗·集成学习
汇能感知3 小时前
光谱相机
经验分享·笔记·科技
tt5555555555554 小时前
STM32一刷学习笔记--杂七杂八(1)
笔记·stm32·单片机·嵌入式硬件·学习
Octopus20775 小时前
【C++】AVL树的旋转等
c++·笔记·学习
LuckyLay5 小时前
Golang学习笔记_10——Switch
笔记·学习·golang·switch