Skip to content

Instantly share code, notes, and snippets.

@ufologist
Created July 13, 2016 07:12
Show Gist options
  • Save ufologist/b5a138d13c02be8df77ea1a78ee44362 to your computer and use it in GitHub Desktop.
Save ufologist/b5a138d13c02be8df77ea1a78ee44362 to your computer and use it in GitHub Desktop.
微信分享的默认机制
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>微信分享的默认机制</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
</head>
<body>
<img src="http://placeholder.qiniudn.com/300x300" width="0" height="0" style="position:absolute">
<h1>微信分享的默认机制</h1>
<p>利用微信分享(分享到朋友圈和分享给朋友)的默认机制(不需要 JSSDK 验证配置也可以控制分享的内容), 我们可以尽量避免出现分享时出现错误的图片</p>
<ul>
<li>分享图标默认为网页中找到的第一个尺寸大于 300 * 300 的非隐藏(不能设置 display:none 或者 visibility:hidden)图片</li>
<li>分享标题默认为网页的 title</li>
<li>分享描述(分享给朋友时才会出现)默认为网页的域名(IP), 这个在没有启用 JSSDK 时是无法修改的</li>
</ul>
<p>因此我们可以尝试在页面中添加一个"隐藏"的图片来达到这个目的, 例如: 网站首页则隐藏一个网站的 LOGO, 商品页面则因此一个商品的图片</p>
<pre>&lt;img src="http://placeholder.qiniudn.com/300x300" width="0" height="0" style="position:absolute"&gt;</pre>
</body>
</html>
@PeanutChen
Copy link

新版微信已失效

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment