JavaScript: openAssessmentIframe
Overview
The openAssessmentIframe JavaScript function returns HTML that can be rendered in an iFrame to allow users to perform assessments.
Beta API
NOTE: This API is currently in beta and applies only to the 'iFrame' API customers (see example below).
Function Arguments
Argument | Value | Example |
---|---|---|
User-Agent | <company identifier> | The exact value here is not important, but it should include something to identify your company. |
Accept-Language | The language locale | This is the locale to display the UI in; the locale of the assessment is determined by the Learner's locale (See /1/purchase - POST). |
Sign In Token | <your bearer token> | The token received from a call to /1/signin - GET |
X-SystemDomain | <the system domain> | vbmapp |
X-LearnerId | <the learner id> | The DMTD-supplied identifier that identifies the learner (see REST API Guide) |
X-LearnerCode | <the learner code> | A REST-client-supplied identifier that identifies the learner (see REST API Guide) |
JavaScript Element | The HTML DOM element under which to host the iFrame |
Example
Example
<!DOCTYPE html>
<html>
<head>
<script src="https://[staging|www].vbmappapp.com/javascripts/iframe_support.js"></script>
<script type="text/javascript">
window.onload = function() {
openAssessmentIframe(
'<your user agent key>', // User-Agent
'en', // Accept-Language
'<a sign in token>', // Sign in token
'vbmapp', // X-SystemDomain
42, // X-LearnerId
null, // X-LearnerCode
document.getElementById('mount-point') // The mount point for the iFrame in this document
)
}
</script>
</head>
<body>
<h1>Welcome to VB-MAPP!</h1>
<div id="mount-point">
</div>
</body>
</html>
Response
<html>
<head>...</head>
<body>
<h1>Welcome to VB-MAPP!</h1>
<div id="mount-point>
<iframe> ... vb-mapp here </iframe>
</div>
</body>
</html>