Skip to content

Instantly share code, notes, and snippets.

@metavida
Last active December 17, 2015 23:19
Show Gist options
  • Save metavida/5688269 to your computer and use it in GitHub Desktop.
Save metavida/5688269 to your computer and use it in GitHub Desktop.
Sample HTML code that a teacher might paste into a Haiku Learning Embed the Web™ block, and an example of the contents of the JS file, which will pass the login of the current user on to the widget.php page.
<script type="text/javascript" src="https://your.domainna.me/path/to/widget.js">
(function() {
if(HaikuContext && HaikuContext.user) {
var widgetURL = 'https://your.domainna.me/path/to/widget.php?';
widgetURL += 'user=' + encodeURIComponent(HaikuContext.user.login) + '&';
if(HaikuContext.user.import_id)
widgetURL += 'import_id=' + encodeURIComponent(HaikuContext.user.import_id) + '&';
document.write('<iframe src="' + widgetURL + '" height="200" width="200"></iframe>');
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment