sample.html
unknown
php
2 years ago
1.9 kB
8
Indexable
<h1>Test Page</h1>
<script src="https://test-glasgowacademy.proctoring.app/sdk/supervisor.js"></script>
<script>
// create Supervisor instance
var supervisor = new Supervisor({ url: 'https://test-glasgowacademy.proctoring.app' });
// log in and initialize the session
supervisor
.init({
// set your provider name
provider: 'jwt',
// get JWT string from your server
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Im1hcmlhYm9yc2hldmEiLCJuaWNrbmFtZSI6IkpvaG4gRG9lIiwiaWRlbnRpZmllciI6Im1hcmlhYm9yc2hldmEtdGVzdDIiLCJ0ZW1wbGF0ZSI6ImRlZmF1bHQiLCJzdWJqZWN0IjoiVHV0b3JpYWw6IHByb2N0b3JpbmciLCJ0YWdzIjpbIm1hbGUiXX0.7Xpto1xQ_kAzB00k4ajPE2Odb0PxCKa9hLk19nbVceQ'
//token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Im1hcmlhYm9yc2hldmEiLCJuaWNrbmFtZSI6IkpvaG4gRG9lIiwiaWRlbnRpZmllciI6Im1hcmlhYm9yc2hldmEtdGVzdDIiLCJ0ZW1wbGF0ZSI6ImRlZmF1bHQiLCJzdWJqZWN0IjoiVHV0b3JpYWw6IHByb2N0b3JpbmciLCJ0YWdzIjpbIm1hbGUiXX0.q1TEYdLmrotaVrFvGGjb--Qw5A59WoNDSPCtPRAmB3s'
})
.then(function() {
// start the session only after initialization
return supervisor.start();
})
.then(function() {
// start testing in the e-learning system here
})
.catch(function(err) {
// show alert with an error
alert(err.toString());
// redirect to home page
location.href = '/';
});
// stop the session after testing in the e-learning system is over,
// the timeout function is used here as an example
setTimeout(function() {
// stop the session
supervisor.stop()
.then(function() {
// log out the session
return supervisor.logout();
})
.then(function() {
// your action here after the successful completion of the session
});
}, 5 * 60 * 1000); // 5 minutes
</script>
</script>
</html>Editor is loading...