Novice JavaScript question

I am experimenting with an audio recorder suggested by Sergey. It works fine when I run it from a standard html page (i.e. the demo code provided).

The source .js files live as below:

undefined

Discussion (2)

Hi Andrew,

I am not a programming pro, but I will try my best to help. If you do add your script as External HTML - which would be the best way to add JavaScript to your course - you could add just multiple External HTML objects, or you could experiment with the Additional Files option in the Properties Ribbon.

And when it comes time to call the functions, you can indeed just add a Run JavaScriptAction action to your button.

I think you're on the right track.

@ssneg - Any additional thoughts?

undefined

This blog explains how to add JS scripts to your title. And this Part 2 Blog explains how to optimize it with a few tricks.

(a) How do I link the source files to Lectora? Do I use an external html object and then place search for the files and put them in Header Scripting? That would seem to be the way (my first attempt).

First of all, create an empty folder, call it smth like "ext_js". Attach this folder to the Ext HTML Object you've just created (use Attached Files dialog). Or you could attach them to the title, or to the page, but I feel it's logical to attach them to the Ext HTML Object and do it every time so that I don't have to look everywhere around my title for script files.

Now your title has folder "extern", which contains "ext_js". Put whatever files you need in this folder. When your title is published, the whole contents of "extern" will be placed in the root folder of published Lectora title, so you'll have a single neat "ext_js" folder that would contain any amount of scripts you might have.

Create an Ext HTML Object, set it to Meta tags and include all your script tags in it. If you went with my "ext_js" suggestions, the paths could look like this:

undefined".

Discussions have been disabled for this post