复制文本自动打开微信客户端代码

可以实现在iOS或者Android手机中复制某一文本之后直接调用打开微信的的效果:

<html>
<head>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<meta charset="UTF-8">
<title>Pop WeiChat COPY</title>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<link rel="stylesheet" href="./style.css" class="css" />
<style type="text/css">
*{
margin: 0;
padding: 0;
}
div{
text-align: center;
}
span{
display: inline-block;
margin-top: 50px;
font-size: 30px;
}
</style>
<script type="text/javascript">
$(function(){
document.body.oncopy =function(){
window.location.href='weixin://';
}
});
</script>
</head>
<body>
<div>
<span>复制Pop的任意文字即可打开微信!</span>(←长按复制)
</div>
</body>
</html>

Related Posts