Skip to content

HOWTO xAPI bookmarklet - https://xapi.com/bookmarklet #1507

@HaakonME

Description

@HaakonME

HOWTO xAPI bookmarklet

The xAPI bookmarklet at https://xapi.com/bookmarklet/ asks for e-mail, name, LRS endpoint, LRS username and LRS password to create a bookmarklet, which is just a Javascript-link you can add to your browser's bookmark toolbar.

Sending the xAPI statement for the page you are on from the browser using the xAPI bookmarklet may fail because of incompatible security settings between the web page you are viewing and your Learning Locker LRS. This HOWTO xAPI bookmarklet explains how to solve this issue.

Sending xAPI statements fail - why?

Give the xAPI bookmarklet setup page at https://xapi.com/bookmarklet an email and a name, then look in your Learning Locker > Settings > Clients and give it the xAPI Endpoint listed there - http://IP/data/xAPI - as the LRS endpoint, add the client Key value as the LRS username and the client Secret value as the LRS password. If the bookmarklet fails to send statements from the browser, then how can you fix this?

(Note: the client I had was used by Moodle to send statements to Learning Locker, so I knew LL can receive statements using the client. Come to thing of it, I think http://IP/data/xAPI/statements was necessary in Moodle.)

Two different issues when your browser's xAPI bookmarklet talks to Learning Locker

xAPI bookmarklet at https://xapi.com/bookmarklet requires similar security at both ends to avoid Mixed Content errors and CORS policy issues.

Mixed Content - HTTPS at one end, HTTP at the other end

If the page in your browser that you want to send a statement about is delivered over HTTPS then your Learning Locker LRS needs to receive the page over HTTPS too. If not, this will cause a Mixed Content error in your browser console log, and the browser will not send an xAPI statement to your Learning Locker LRS.

CORS policy - you need an insecure browser session

However, finding a page delivered over HTTP is not enough to send to an HTTP Learning Locker. The next issue you will run into is CORS policy, so you need to turn that off temporarily in a separate browser window.

Windows with insecure Google Chrome session in separate browser window

On Windows with Google Chrome, create the folder "C:/Chromedev", then in a Console Window run - with the quotes to get the path right - "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir="C:/Chromedev" --disable-web-security . This opens a new browser with CORS disabled.

Visit https://xapi.com/bookmarklet and create the bookmarklet link. Copy the URL, and create a new bookmark in the new browser window's bookmark toolbar.

Visit a page served over HTTP, and this time you should be able to send an xAPI statement to your HTTP Learning Locker.

Best of luck, this worked for me. :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions