When WeChat shares webpages, display thumbnails and titles

Open the adaptive web page in WeChat, you can directly share it to your circle of friends and send it to your friends. To display a thumbnail, title, and description when sharing, follow these steps:

1. Log in to the authenticated WeChat Official Account, and go to Development -> Basic Configuration -> Official Account Development Information to obtain the AppID and AppSecret; and add the IP address of the server where the webpage is located to the IP whitelist (obtain access_token).

2. Check  the WeChat JS-SDK documentation , here select the DEMO of the php version in Appendix 6. According to the demo description: All JS interfaces can only be called under the domain name bound to the official account. The official account developer needs to log in to the WeChat public platform and enter the "Function Settings" of the "Official Account Settings" to fill in the "JS interface security domain name". According to the precautions of the JS interface, fill in the registered domain name or directory.
Note that according to the description in Policy Adjustment of JSSDK Custom Sharing Interface , the current page being visited and the custom links and pictures to be shared must be in the JS secure domain name.

The shared custom links and pictures can be file links and pictures under the secure domain name, or file links and pictures in the secondary directory under the secure domain name.
If the js security domain name is www.ms.com/abc and the current page is www.ms.com/abc/index.php, the content to be shared can be:
(1) Custom link: www.ms.com/abc /show01.htmlCustom
     picture: www.ms.com/abc/pic01.jpg
(2) Custom link: www.ms.com/abc/xxx/show02.htmlCustom
     picture: www.ms.com/abc /yyy/pic02.jpg

Key points: 1. The official account has passed the certification. 2. Only the links and pictures under the JS secure domain name can be shared, and the current page path must also be in the secure domain name.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325336679&siteId=291194637