1. Problem description:
Wechat official account to share custom content. At the beginning of sharing, custom content can share the current url, but when you modify the link in sharing (the link domain name is the same as the JS security domain name corresponding to the current page), the current url. at the time of sharing will be redirected
- `
title = shareDetail.getString("title");
desc = shareDetail.getString("summary");
// https://xxx.xxx.com/teaching/a?id=72 + &sharerOpenId=xxx
StringBuilder sb = new StringBuilder();
sb.append(shareDetail.getString("url")).append("&sharerOpenId=").append(sharerOpenId);
url = sb.toString();
imgUrl = shareDetail.getString("pic_url");`
JSONObject shareInfo = new JSONObject();
//
shareInfo.put("title", title);
//
shareInfo.put("desc", desc);
// JS,
shareInfo.put("link", url);
//
shareInfo.put("imgUrl", imgUrl);
// ,musicvideolinklink
shareInfo.put("type", "link");
// typemusicvideo
shareInfo.put("dataUrl", "");
responseData.put("shareInfo", shareInfo);
The - code, such as the, title desc imgUrl above, is obtained normally. Link is a custom url that replaces the url, of the current page
4. The title desc imgUrl is normal when the result is shared, and link is the url
5 of the current page. Expect link to be stitched url: https://xxx.xxx.com/teaching/. + & sharerOpenId=xxx
the reason why the shareInfo.link, obtained by the front-end link cannot be found. Ask the gods for help.