<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>引导用户复制链接到手机浏览器浏览</title>
	<style>
		body {
			font-family: Arial, sans-serif;
			text-align: center;
			margin: 0;
			padding: 0;
		}
		h1 {
			margin-top: 50px;
			font-size: 2em;
		}
		p {
			font-size: 1.2em;
			margin-top: 20px;
			margin-bottom: 50px;
		}
		button {
			font-size: 1.2em;
			padding: 10px 20px;
			background-color: #008CBA;
			color: #fff;
			border: none;
			border-radius: 5px;
			cursor: pointer;
			transition: background-color 0.3s ease;
		}
		button:hover {
			background-color: #005A6E;
		}
	</style>
</head>
<body>
	<h1>引导用户复制链接到手机浏览器浏览</h1>
	<p>您当前正在使用微信或QQ浏览本站,为了更好的浏览体验,请复制以下链接到手机浏览器中打开。</p>
	<p><strong>当前页面链接:</strong><br><a id="pageLink" href="#">http://www.example.com</a></p>
	<button id="copyBtn">复制链接</button>
	<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
	<script>
		$(document).ready(function() {
			// 获取当前页面链接
			var pageLink = window.location.href;
			$("#pageLink").attr("href", pageLink);
			// 复制链接
			$("#copyBtn").click(function() {
				var copyText = document.getElementById("pageLink");
				copyText.select();
				copyText.setSelectionRange(0, 99999);
				document.execCommand("copy");
				alert("链接已复制,请打开手机浏览器粘贴并打开。");
			});
		});
	</script>
</body>
</html>
用html+jq+css 如果域名在微信或者QQ中引导用户复制链接到手机浏览器浏览

原文地址: https://www.cveoy.top/t/topic/besa 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录