Hype4 button on click don't work

Hello, everyone, I would like to ask when I use the facebook share and htme2canvas screenshot function in the button trigger event, the button function does not respond after publishing.. What is the problem? @@?

 html2canvas(document.getElementById('imgGroup')).then(function(canvas) {
 document.body.appendChild(canvas);
  var dataUrl = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
  console.log(dataUrl);
});

FBInstant.shareAsync({
  intent: 'SHARE',
  image: img,
  text: '快來測驗看看你的厚老師指數多高!?',
  data: { myReplayData: '...' },
}).then(function() {
  // continue with the game.
  comsole.log("2");
});

Do you see any errors in the browser's console?

no any error

just my button click is not anythink .. button don't work

i am use
<script type="text/javascript" src="html2canvas.min.js"></script>
in my index

If you have that file in your resources library, you should reference it like this:

src="${resourcesFolderName}/html2canvas.min.js"

so i am use
<script src=""${resourcesFolderName}/html2canvas.min.js"></script>
in my index head ?

Yes that will load that file from your resource library (and the ${resourcesFolderName} variable will be replaced on export). Or, use:

<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.min.js" integrity="sha512-s/XK4vYVXTGeUSv4bRPOuxSDmDlTedEpMEcAQk0t/FMd9V6ft8iXdwSBxV0eD60c6w/tjotSlKu9J2AAW1ckTA==" crossorigin="anonymous"></script>

thank you very much Daniel , i try it , thank you ~

Hello, I got this error message. What does this definition mean?

this is my hype js ..

You are returning a dataUrl but there is no recipient. Also, html2canvas runs in an asynchronous manner. Meaning you would need to use await … but in this case it should be much easier to just put the whole FBInstant block into your callback and replace the return statement with it. That should do the trick. I am also not sure if FB likes it that the image has no hosting provider…

Thank you for your advice, because I just learned js and I am not familiar with the code @@I am studying and looking, thank you~

You're welcome. If you have further questions let me know. Also, if you get it to work.

ok thank you so much ~ Frankly speaking, I don’t even know how to combine FBInstant.shareAsync and html2canvas... But thank you, I’ll try it out.

Currently I have encountered this problem which is not a function.. Does anyone know how to solve it?


Can you share your Hype document?

of course !and thank you very much ~

https://archytas-aero.com/teacher/taiwan_user_hype4.zip

Oh, you posted a document. Here is something I put together without having your document… maybe it helps. Good luck!

fbShare.hype.zip (21,6 KB)

thank you very much ~ I will try and practice ~ Share if you succeed

i am sorry , i try it , no any error , but button don't working