H5 after capturing the current screen using canvas, can you directly call Wechat api and share it to moments?

Product requirements: there is a custom sharing button on the h5 page. Click the custom sharing button to capture the current page, and then share it to moments

difficult: is this not available in jssdk? click the custom share button to directly access the api of moments? The compromise I think is to generate a screenshot, prompt the user to press the screenshot to save it locally, send it to the moments, and select the screenshot saved locally.



wx.ready(function () {      //
    wx.updateTimelineShareData({ 
        title: '', // 
        link: '', // JS
        imgUrl: '', // 
        success: function () {
          // 
        }
});

take a look at Wechat jssdk development documentation


landlord, have you solved your problem? I have encountered the same problem


official account has not been able to achieve the function you mentioned. Oh,


sharing must be triggered actively by the user, and can only guide the user to click on the upper right corner to share.
in addition, the shared image must be a link, and you have to find a way to upload the base64 data generated by the canvas image to the file server to generate a link.


I said I could do it.

  1. canvas screenshot is transferred to the server, and the server provides a picture link
  2. The
  3. front end receives this picture and updates the Wechat sharing settings on the current page
  4. A pop-up message prompts the user to share
Menu