Solved

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

Posted on 2013-11-26
8
540 Views
Last Modified: 2013-11-26
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
0
Comment
Question by:freshwaterwest
  • 5
  • 3
8 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39676906
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.
0
 

Author Comment

by:freshwaterwest
ID: 39676944
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
0
 

Author Comment

by:freshwaterwest
ID: 39677007
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 : )
0
 

Author Comment

by:freshwaterwest
ID: 39677184
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 : )
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39678493
It sounds to me more like a timing problem where some data isn't available as quickly coming from the live server as it is from your own computer.
0
 

Author Comment

by:freshwaterwest
ID: 39678533
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.
0
 

Author Closing Comment

by:freshwaterwest
ID: 39678534
Good thinking - thanks for the suggestion
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39678575
You're welcome, thanks for the points.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now