Link to home
Start Free TrialLog in
Avatar of freshwaterwest
freshwaterwestFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Simple LMS having loading errors only on live server (clear browser cache resolves)

I've integrated VSSCORM (http://www.vsscorm.net/) into my CMS - it's basic but it works perfectly on my local test server (MAMP). I should also mention the SCORM packages are all tested on scormcloud to confirm they are correct first. The problem occurs on the Linux/Apache server (shared hosting).

When I test it on the live site server - a course will load for the first visit (or first few times) but then will show a blank screen and a javascript error:

  TypeError: SCORM_objAPI.LMSInitialize is not a function
  strResult = SCORM_objAPI.LMSInitialize("");

If this happens, a browser cache clear and reload, it will work again every time.

My first thought was I could simply try to stop the browser caching:

Added to the <head>...
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />

Then also tried adding to htaccess...
<FilesMatch "\.(swf)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</FilesMatch>

None of which makes any difference - the problem remains and the cache clear still does the trick.

Any ideas?
Many thanks
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

The 'meta' tags only affect the HTML part of the page, not the javascript files which will be cached separately.  And 'swf' is Adobe Flash so I'm not sure why you have that there.
Avatar of freshwaterwest

ASKER

Hi Dave, thanks for your reply,

I'd expected that the problem might be the swf file being cached so it was an attempt to prevent that, but I hadn't considered javascript caching.

Why might javascript be caching differently on the live server and what could I do to test it/prevent the caching?

thanks
Phil
I think I may have sorted this, simply by adding a random number var to the course link/path. Seems to be working OK now : )
No - still having the issue although now I can simply refresh the window once or twice and it seems to work which is an improvement : )
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Dave, I think I've sussed this out and yes it appears you are right with the timing suggestion. What I've done is put a slight delay in loading the SCO so it gives the rest of the container files chance to load properly. Before doing this I had also initially nullified some javascript cache variable values inside the LMS code which seemed to improve things.
thanks for your help - I'll award the points as you have actually hit the nail on the head.
Good thinking - thanks for the suggestion
You're welcome, thanks for the points.