Welcome to the Lectora and CourseMill Forums
If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed.
-
onbeforeunload trouble
Hello All,
I have already tried to search the site for the window.onbeforeunload or placing the onbeforeunload call in the opening body tag.
Are you sure you want to exit...
Code to Remove Browser X?
My problem I am facing is that when I publish my Lectora course as HTML both methods work just fine.
However, when I attempt to publish the course as SCORM neither method works.
I need to fire a callback function to my web app before the browser closes.
Any suggestions or feedback will be greatly appreciated.
Kindest regards,
-James
As a side note: I am making the change to the HTML page via notepad after Lectora has published the course. <--bad practice...I am accustomed to doing things by hand and don't really use WYSIWYG programs.
-
-

Does anyone have a clue or run into the same issue?
-
-
Do I need to have my custom JS placed somewhere else on the page instead of in the head?
-
-
Maybe in SCORM mode, the SCORM API takes over? Did you check if there is another onbeforeunload function in place?
-
-

Originally Posted by
ssneg
Maybe in SCORM mode, the SCORM API takes over? Did you check if there is another onbeforeunload function in place?
After going through all the code, there does not appear to be one.
I will do a second run through of all code including the external scripts that are imported.
If in the even the API is the reasoning do you have any advice on how to accomplish this feat?
Thank you very much for taking a look at and responding to my thread.
Kindest regards,
-James
-
-
I don't see an onbeforeunload fired in scorm, but there is an unload function in the scofunctions.js file:
function unloadPage(bForce) {
var exitPageStatus = readVariable( 'TrivantisEPS', 'F' );
if (exitPageStatus != 'T') {
if( window.name.length > 0 && window.name.indexOf( 'Trivantis_' ) == -1 ) doQuit(bForce);
}
else if( finishCalled != true && autoCommit == true ) {
computeTime();
LMSCommit();
}
}
Visit
http://www.justinball.net for:
Lectora eLearning Development, Adobe Flash Development, DotNetNuke Development, Adobe Captivate Development, eLearning, Simulations, Demonstrations, Interactive Training, Websites, eLearning, Simulations, Animations, Logos, Videos, Games, ASP.NET Development, SQL Databases, AJAX Integration, Web Services, SharePoint Webparts, Windows Forms
-
-
There may be another solution. It's from what I can tell SCORM specific, and dependent on using a titlemanager file during the publishing process.
After publishing the course using SCORM, and checking the option to use a javascript title manager in the options tab go to the published files, open the a001index.html file for editing. In the space between the code block of script languages and above the trivWeb20Popups = true code paste the onbeforeunload code. That worked for me. Any other way that I tried, it was firing the warning pop when any link was clicked, navigation performed, table of contents chosen etc.
Here's a snippet of what it looks like on my page.
<script language = "JavaScript" src="trivantis.js"></script>
<script language = "JavaScript" src="trivantis-cookie.js"></script>
<script language = "JavaScript" src="trivantis-strings.js"></script>
<script language = "JavaScript" src="trivantis-titlemgr.js"></script>
<script language = "JavaScript" src="trivantis-titlemgr-interact.js"></script>
<script language = "JavaScript" src="trivantis-dialog.js"></script>
<script language = "JavaScript" src="apiwrapper11.js"></script>
<script language = "JavaScript" src="scofunctions.js"></script>
<script language = "JavaScript">
<!--
window.onbeforeunload = function (e) {
e = e || window.event;
// For IE and Firefox prior to version 4
if (e) {
e.returnValue = 'WARNING! Progress data may be lost if you close the player window. To prevent data loss, click Cancel and use the player exit button to close the course.';
}
// For Safari
return 'WARNING! Progress data may be lost if you close the player window. To prevent data loss, click Cancel and use the player exit button to close the course.';
};
trivWeb20Popups = true;
..... page truncated
Last edited by 8ball; 02-22-2012 at 04:00 PM.
Visit
http://www.justinball.net for:
Lectora eLearning Development, Adobe Flash Development, DotNetNuke Development, Adobe Captivate Development, eLearning, Simulations, Demonstrations, Interactive Training, Websites, eLearning, Simulations, Animations, Logos, Videos, Games, ASP.NET Development, SQL Databases, AJAX Integration, Web Services, SharePoint Webparts, Windows Forms
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
Lectora and CourseMill are registered trademarks of Trivantis Corporation, Camtasia and Snagit are registered trademarks of TechSmith Corporation and
Flypaper is a trademark of Flypaper Studio. Camtasia and Snagit are used with the permission of TechSmith Corporation.
Copyright © 1999-2012 Trivantis Corporation Inc. All rights reserved.