Javascript to check if a file exists

Hi Folks

I'm sure this is possible somewhere, but I'm not really fully au fait with Javascript.  I'm looking for a bit of script to check if a file exists and then return a boolean of true (or false if it's not there).

I know that is sounds like something totally unrelated to Storyline but it is I promise!  As we have so many departments, there are a few courses that are department specific.  As such if anyone moves from one department to another, I thought we could put in a type of 'admin' screen in storyline, that will ask for them to input an authorisation code which would be the same as the filename that Javascript checks.  The javascript will check that the filename is present (come back with true if it is) and let the user end the course without having to go through it all.  This will help us to make sure the user isn't bombarded with messages from our training department to say they've not finished the course.  Of course, the reason for the file to be in a shared location is to confirm that the authorisation code is available, and that once it's been used, I can then remove the file and no one else will be able to use it. 

Hope that makes sense.  Can anyone help me with the Javascript code?

Many thanks

Ian

Be the first to reply