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"
    }
相关推荐
我爱挣钱我也要早睡!2 小时前
Java 复习笔记
java·开发语言·笔记
汇能感知6 小时前
摄像头模块在运动相机中的特殊应用
经验分享·笔记·科技
阿巴Jun7 小时前
【数学】线性代数知识点总结
笔记·线性代数·矩阵
茯苓gao7 小时前
STM32G4 速度环开环,电流环闭环 IF模式建模
笔记·stm32·单片机·嵌入式硬件·学习
是誰萆微了承諾7 小时前
【golang学习笔记 gin 】1.2 redis 的使用
笔记·学习·golang
DKPT8 小时前
Java内存区域与内存溢出
java·开发语言·jvm·笔记·学习
ST.J8 小时前
前端笔记2025
前端·javascript·css·vue.js·笔记
Suckerbin8 小时前
LAMPSecurity: CTF5靶场渗透
笔记·安全·web安全·网络安全
小憩-9 小时前
【机器学习】吴恩达机器学习笔记
人工智能·笔记·机器学习
UQI-LIUWJ9 小时前
unsloth笔记:运行&微调 gemma
人工智能·笔记·深度学习