URL Variables Import


we have just recently upgraded to Lectora12 and have a question. Our new LMS will be sending variables contained in the launch URL and id like to parse/extract that information at runtime. I've been able to successfully do it by manually extracting the ZIP file, editing the a001_index.html file with some JavaScript, but I am looking at making this automated at publish time so that my developers don't need to constantly update the code manually.

Ideally, the parameters/variables would be stored in a Lectora variable for use when required.

Example of a URL: ..../en/a001_index.html?localmediaserver=mynewserver&var2=someData

Any assistance is greatly appreciated.


Discussion (7)

OK, I have done a little more research because I couldn't let this sleep for the night and I have found a way to do most of it using JavaScript (see below).


When I place this at the Top of file scripting, I get the alert to work properly showing me the a001index.html but when I try to associate it to a variable within Lectora (_newURL), it does not work. Any suggestions? I've tried to "prove" or "show" the variable with another popup window via Lectora but it comes up at 0.

I've attached two screenshots of the code I have tried.


Well then, I tried it out and no luck. It is now providing me with the a001titlemgr.html . Is there anyway to get the a001index.html level? Do I really need to use the a001index.html for a single SCO course that must report back to the LMS?

And BINGO was his name-o ! Thanks very much Tim. It works in the RELOAD SCORM Tool but now to test on the new LMS.

Much thanks!

Putting the code into an external html object like this will just add the code to the source code of your page. It won't be executed. Either copy the code to a "Run javascript" action (without the undefined tags) On: Page show or run it via jquerys $(document).ready() in the html extension.



when you publish to Scorm or HTML and have "Include Title Manager Frame" checked, and click on the link in the LMS the index.html is opened. This file contains two frames:

1. titlemgrframe

2. contentframe

The titlemgrframe contains the page "a001titlemgr.html". The purpose of this page is (among others) to change the content of the contentframe to "a001_page_1.html", the first page of your title (will be named differently of course). As far as I know, document.referrer will contain the URL of the page that loaded the current page, i.e. the page from that the action is run. In your case this will indeed be "a001titlemgr.html", the page that initiated the loading of the page into the contentframe.

Which URL do you get if you use "window.location.href"? In my test this was ".../page_1.html"

Which URL do you get if you use "top.location.href"? In my test this was ".../index.html"


Hi Tim,

This is great information and I thank you for taking the time out of your day to help me along this path.

I used the "top.location.href" code within a *.js file, called it from the index.html, and it did indeed return the index.html?localserver=localURL , but sadly when I include this within the Lectora package within an action it does not return what I'd hope (main.asp?). I believe this code is being called at the a001_course_content_page01.html and not at the index.html (where it is required).

I will work with the direction you've given me and hopefully be able to figure out the next steps from here.

Cheers and thank you,



I've now tested the different settings in moodle:

document.referrer = .../a001titlemgr.html

window.location.href = .../page1.html

top.location.href = .../player.php?... (the page with the moodle Scorm player)

parent.location.href = .../a001index.html


Discussions have been disabled for this post