getting maximum score before interaction
Submitted by samchinnu on Tue, 08/23/2022 - 08:19
Forums:
Hi guys,
I need to get score of a content once it loads in iframe before user clicks check answer. Is that possible?
I created the content in wordpress using h5p plugin. using the embeded iframe in another website. so i need to get the maximum score in display in my page.
Can anyone please suggest me some ideas.
otacke
Tue, 08/23/2022 - 08:49
Permalink
Hi!You could call
Hi!
You could call `getMaxScore()` on the content instance of most content types (see https://h5p.org/documentation/developers/contracts), but this will not work if the iframe source is on a different domain. Browsers prevent cross-origin access via iframes for good reasons, and H5P does not provide another mechanism to ask for the maximum score.
Best,
Oliver
samchinnu
Tue, 08/23/2022 - 14:48
Permalink
H5P.externalDispatcher.on(
otacke
Tue, 08/23/2022 - 15:16
Permalink
So you have control over the
So you have control over the server side that's embedded from, too? Then don't wait for xAPI data to be sent, but wait until the content is initialized and call`getMaxScore` on the instance and return that result via post messaging.
samchinnu
Tue, 08/23/2022 - 15:37
Permalink
Hi
Do you have any sample to get getMaxScore during loading?
thanks for your support.
otacke
Tue, 08/23/2022 - 17:33
Permalink
You can wait for the external
You can wait for the external dispatcher to send `initialized` and then check `H5P.instances` for your instance that you can call `getMaxScore()`on. What do you need this for by the way?
otacke
Thu, 08/25/2022 - 22:36
Permalink
Hey! Just checking your
Hey! Just checking your progress. Did you figure it out?
samchinnu
Tue, 08/23/2022 - 15:26
Permalink
HI
samchinnu
Tue, 08/23/2022 - 15:26
Permalink
HI