adlnet / xAPIWrapper

Wrapper to simplify communication to an LRS
https://adlnet.gov/projects/xapi/
Apache License 2.0
219 stars 114 forks source link

Feature request: Make `getQueryVariable` iframe aware or at least allow to pass launch parameters to `launch` explicitly #165

Open ralokt opened 4 years ago

ralokt commented 4 years ago

The current implementation of ADL.launch uses getQueryVariable [1], which assumes that it will always be able to get the launch parameters from window.location. This is not true if window is an iframe, for example for an embedded H5P on a Moodle page.

It would be great if this use case could be supported somehow, perhaps by trying to get launch parameters from the parent iframe (if it exists) as a fallback, or by allowing to override the launch parameters by passing them explicitly.

[1] https://github.com/adlnet/xAPIWrapper/blob/d6637d3e2a63f728d467b97ba111e85410de639c/src/xapi-launch.js#L3