Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7597479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:09:57+00:00 2026-05-30T22:09:57+00:00

Hi im looking a way to bookmark a page with JavaScript so that when

  • 0

Hi im looking a way to bookmark a page with JavaScript so that when a user reopens a course it remembers the page he or she is on by sending it to SCORM/Moodle.

any ideas folks?

using scorm 1.2 and Moodle 1.9:)

Many Thanks

<!-- ================ -->
<!-- Bookmarking start -->
<!-- ================ -->
<script type="text/javascript" src="SCORM_API_wrapper.js"></script>
<script type="text/javascript">
//Using pipwerks namespace, SCORM 1.2

var success = pipwerks.SCORM.init();

if(success){
  var status = pipwerks.SCORM.get("cmi.core.lesson_status");
  if(status != "completed"){
    success = pipwerks.SCORM.get("cmi.core.lesson_status", "completed");
    if(success){
       pipwerks.SCORM.quit();
    }
  }
}

function setbookMark() {
    var setlessonLocation = scorm.set("cmi.core.lesson_location", "2");
}

function showbookMark() {
    alert(scorm.get("cmi.core.lesson_location"));
}

window.onload = function (){
    init();
    setbookMark();
}


</script>
<!-- ================ -->
<!-- Bookmarking End -->
<!-- ================ -->

First index page that is loaded

<script type="text/javascript" src="SCORM_API_wrapper.js"></script>
<script type="text/javascript">
var scorm = pipwerks.SCORM;


function init(){

    //Specify SCORM 1.2:
    scorm.version = "1.2";

    var callSucceeded = scorm.init();
}

function end(){

    var callSucceeded = scorm.quit();
}


function bookMark() {
    var lessonLocation = scorm.get("cmi.core.lesson_location");
    if (lessonLocation == "1") {
        window.location = "1.html";
        }
    else if(lessonLocation == "2") {
        window.location = "2.html";
        }
    else if(lessonLocation == "3") {
        window.location = "3.html";
        }
    else if(lessonLocation == "4") {
        window.location = "4.html";
        }
    else if(lessonLocation == "5") {
        window.location = "5.html";
        }
    else if(lessonLocation == "6") {
        window.location = "6.html";
        }
    else if(lessonLocation == "") {
        window.location = "1.html";
        }
}

window.onload = function (){
    init();
    bookMark();
}

window.onunload = function (){
    end();
}
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:09:58+00:00Added an answer on May 30, 2026 at 10:09 pm

    Setting lesson_location is the equivalent of creating a browser cookie… you need to write JavaScript in your course that parses the saved string and makes use of it.

    You need to change your code in a number of places — the code you’ve provided is an example that sets your course to complete the instant it’s initialized. It isn’t really what you’re looking for.

    Here’s a quick primer on starting the course and looking for a bookmark:

    var bookmark, initialized, status;
    var scorm = pipwerks.SCORM; //shortcut for easier typing
    
    function jumpToPage(url){
    
        //write some code that navigates to the specified url
    
        //Save whatever URL was just used as the bookmark
        //each time the function is invoked.
        scorm.set("cmi.core.lesson_location", url);
    
    }
    
    function init(){
    
        //the default URL in case no bookmark is found
        //or when course is launched for first time
        var url = "url_of_first_page.html";
    
        initialized = scorm.init();
    
        if(!initialized){ alert("Course failed to initialize"); return false; }
    
        //Get the lesson status from the LMS
        status = scorm.get("cmi.core.lesson_status");
    
        if(status === "completed"){
    
            //You're already done, get out of here
            scorm.quit();
            return; //exit init() function
    
        } else if(status === "ab-initio"){
    
            //this is the very first launch, no bookmark will be found in LMS
            //do nothing
    
        } else {
    
            //Check for a bookmark
            bookmark = scorm.get("cmi.core.lesson_location");
    
            //If a bookmark is found, use its value as the target URL
            if(bookmark){ 
                url = bookmark;
            }
    
        }        
    
        jumpToPage(url);
    
    }
    
    
    window.onload = init;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for way to write Javascript programs / scripts on desktop, not inside
I looking for a way, specifically in PHP that I will be guaranteed to
I'm looking the way to build an AddIn for Outlook with Python that add
I am looking for a way to add an HTML element using JavaScript. But
I'm looking for way to verify whether a site is categorized in any url
Is there any fast (and nice looking) way to remove an element from an
I looking for way to redirect any 404 error into index.php ErrorDocument 404 /index.php
I'm looking for way to PHP to detect if a script was run from
I'm looking a way to enable IP logging with log4net in ASP.NET. I found
I'm looking a way to build conditional assignments in bash: In Java it looks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.