Moodle: Javascript errors preventing SCORM package loading? - javascript

I'm new here and having some issues on my Moodle site through which I provide online training. We upload SCORM packages to the Moodle and recently have had an issue which is stopping the SCORM packages from loading or sometimes just taking a very long time to load.
We receive the SCORM error that the "SCORM player has determined that your internet connection is unreliable or has been interrupted. If you continue in the SCORM activity, your progress may not be saved. You should exit the activity now and return when you have a dependable connection".
However, we have tried this from a number of different internet points and devices, with the same problem reoccurring. We therefore contacted our hosting provider, who replied:
"It appears the issue is coming from the fact that there are quite a few JavaScript errors on the site. I am pasting them below:
Failed to load resource: net::ERR_FAILED
chrome-extension://dliochdbjfkdbacpmhlcpmleaejidimm/cast_sender.js
Failed to load resource: net::ERR_FAILED
chrome-extension://enhhojjnijigcajfphajepfemndkmdlo/cast_sender.js
Failed to load resource: net::ERR_FAILED
chrome-extension://fmfcbgogabcbclcofgocippekhfcmgfj/cast_sender.js
Failed to load resource: net::ERR_FAILED
chrome-extension://pkedcjkdefgpdelpbcmbmeomcjbeemfm/cast_sender.js
Failed to load resource: net::ERR_FAILED
chrome-extension://fjhoaacokmgbjemoflkofnenfaiekifl/cast_sender.js
Failed to load resource: net::ERR_FAILED 4jquery.js:5 Uncaught
TypeError: Cannot read property 'scrollHeight' of null(anonymous
function)
# jquery.js:5x.extend.access
# jquery.js:3x.fn.(anonymous function)
# jquery.js:5e # content-script.js:1d
# content-script.js:1(anonymous function)
# content-script.js:1"
Can anyone assist and help me identify what the problem is that is causing the loading issues with my SCORM packages?
Kind regards
Eddie

I had the same issue with the message SCORM player has determined that your internet connection is unreliable or has been interrupted on all moodle servers, but the server is working fine and the work is saved correctly.
My solutions are two:
Set a bigger timeout (by default, moodle check internet connection with a 2 seconds timeout). You can set this parameter in 5, 7 or 10 seconds. You can set this value on lib/yui/src/checknet/js/checknet.js (search the request to a checknet.txt file)
Remove the checknet functionality. You can comment two lines on /mod/scorm/player.php. The lines you need to comment are these:
$PAGE->requires->string_for_js('networkdropped', 'mod_scorm');
$PAGE->requires->yui_module('moodle-core-checknet', 'M.core.checknet.init', array(array(
'message' => array('networkdropped', 'mod_scorm'),
)));
This is not a solution for a server that works wrong, this is a solution for a server that works fine but the time of the AJAX response is more than 2 seconds.

I don't believe that the first few (for cast_sender.js) are related to the issue at hand; cast_sender.js is a local script related to Chrome's ability to use Chromecast functionality. (Edit: The Google Cast SDK uses a rather "agricultural" method to detect if you're running Chrome with the appropriate extension; it's a known issue. Google chrome cast sender error if chrome cast extension is not installed or using incognito, https://code.google.com/p/google-cast-sdk/issues/detail?id=309)
The later lines they've pasted seem to bubble up from effectively a null pointer in whatever content_script.js is. Is the SCORM content locally produced? Do you know what software was used to create it - e.g. Articulate or Storyline? I presume that content_script.js is part of the player software?

Related

"physi.js" causes the error: "Script cannot be accessed from origin 'null'"

I was trying to play with physi.js library (). I followed all the steps given:
https://github.com/chandlerprall/Physijs/wiki/Basic-Setup
However, I got the error:
Uncaught SecurityError: Failed to construct 'Worker': Script at 'file://172.16.159.200/js/physijs_worker.js' cannot be accessed from origin 'null'.
I tried to go deeper, and saw that the problem with the line:
this._worker = new Worker( Physijs.scripts.worker || 'physijs_worker.js' );
What did cause that issue? The browser is Google Chrome. I checked, the file "physijs_worker.js" appears in the right location.
Browsers don't allow creating workers from local files because that would be a security issue.
See also this question:
Why does not Chrome allow Web Workers to be run in JavaScript?
Just add the chrome extension
https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb?hl=en
and use the extension to launch your index.html. As now it will be running in localhost, there will be no error
Deploy your website on a web server. Without the web server I get the same error.

cast_sender.js error: Failed to load resource: net::ERR_FAILED in Chrome

I recently started receiving the following console errors, without any code changes taking place.
I did not install any extensions recently.
Failed to load resource: net::ERR_FAILED chrome-extension://enhhojjnijigcajfphajepfemndkmdlo/cast_sender.js
Failed to load resource: net::ERR_FAILED chrome-extension://hfaagokkkhdbgiakmmlclaapfelnkoah/cast_sender.js
Failed to load resource: net::ERR_FAILED chrome-extension://enhhojjnijigcajfphajepfemndkmdlo/cast_sender.js
Failed to load resource: net::ERR_FAILED chrome-extension://fmfcbgogabcbclcofgocippekhfcmgfj/cast_sender.js
Failed to load resource: net::ERR_FAILED
I have several YouTube player embeds on the page that are triggering this error, but they are simple:
<iframe width="100%" height="100%" src="http://www.youtube.com/embed/OUR_YOUTUBE_ID?showinfo=0&wmode=transparent" frameborder="0" allowfullscreen=""></iframe>
Has anybody else experienced this?
Apparently YouTube constantly polls for Google Cast scripts even if the extension isn't installed.
From one commenter:
... it appears that Chrome attempts to get cast_sender.js on pages that have YouTube content. I'm guessing when Chrome sees media that it can stream it attempts to access the Chromecast extension. When the extension isn't present, the error is thrown.
Read more
The only solution I've come across is to install the Google Cast extension, whether you need it or not. You may then hide the toolbar button.
For more information and updates, see this SO question. Here's the official issue.
I'm going to add to the answer given before.
It's not a bug in your code or the browser's code. It's the JavaScript code inside the YouTube iframe polls for the extensions it could interoperate with in case they were installed (likely to determine if the extension is installed).
Look at the source of www-embed-player.js (loaded from s.ytimg.com, it's YouTube static files CDN).
You'll find the following:
function Wj(a){return"chrome-extension://"+a+"/cast_sender.js"}
To stop seeing those cast_sender.js errors, edit the youtube link in the iframe src and change embed to v
The error is try to fix a Youtube error.
The solution to avoid your Javascript-Console-Error complex is to accept that Youtube (and also other webpages) can have Javascript errors that you can't fix.
That is all.
A simple fix for this is to install the Google Cast extension. If you don't have a Chromecast, or don't want to use the extension, no problem; just don't use the extension.
In addition to what was already said - in order to avoid this error from interfering (stopping) other Javascript code on your page, you could try forcing the YouTube iframe to load last - after all other Javascript code is loaded.

RequireJS async! plugin with Google Client API - load timeout?

Some clients are failing to load the Google API in a production environment, but I'm not able to find anything wrong with my code.
Here's what I've got:
// Load Google's JavaScript Client API using requireJS !async plugin.
// You can learn more about the async plugin here: https://github.com/millermedeiros/requirejs-plugins/blob/master/src/async.js
define([
'async!https://apis.google.com/js/client.js!onload'
], function () {
'use strict';
console.log("googleAPI has loaded", window.gapi, window.gapi.client);
return window.gapi;
});
I've pulled this information from: Load async resource with requirejs timeout
The error message being displayed is:
Uncaught Error: Load timeout for modules:
async!https://apis.google.com/js/client.js!onload_unnormalized2,async!https://apis.google.com/js/client.js!onload
http://requirejs.org/docs/errors.html#timeout
This code doesn't produce any issues for me locally. It loads fine.
The first step I took to debug the issue was increasing the waitMinutes in requireConfig from 7 to 90. I thought maybe many people have very slow connections:
define(function () {
require.config({
baseUrl: 'js/',
enforceDefine: true,
// I'm seeing load timeouts on in googleAPI -- seeing if increasing wait time helps.
waitSeconds: 90,
...
});
});
This did not seem to affect the issue. I still see many clients reporting an issue.
What other debugging options are available to me in this scenario? Thanks
So I ran into a similar issue when trying debug my application in Internet Explorer 8, and maybe my experience is similar to your clients'.
For me, I found that I was receiving a timeout error because my test browser was having issues retrieving resources through https due to outdated root certificates. I do all of my Internet Explorer testing in a VM running windows 7. When I was trying to load my application I received the same error you mentioned in your post:
Uncaught Error: Load timeout for modules:
async!https://apis.google.com/js/client.js!onload_unnormalized2,async!https://apis.google.com/js/client.js!onload http://requirejs.org/docs/errors.html#timeout
I tried the url manually and was brought to a 'Untrusted Certificate' warning page on my browser. This confused me, but as I later found out the root certificates on my windows os were outdated and causing a failure with the https handshake. The async plug-in seems to consume the authentication exceptions and just sits waiting for something to magically go through leading to the timeout error.
The solutions I found to work are as follows:
Update the root certificates of the os
Change the security properties of my browser to not require certificate authentication
As for suggestions for further debugging, I have two ideas:
Try setting your browser's security properties as high as possible and see if you can recreate the issue (or just temporarily remove your local certificates)
Ask your clients to set their browser's security properties as low as possible, making sure to disable certificate authentication requirements, and ask them if they are still having problems. (If their problems go away, they might need to manually update their local certificates)

html5 manifest fetch failed (-1)

I am developing a web app in which I am trying to use the HTML5 application cache.
I am running the application on apache tomcat 7. When the server is running it's OK; file downloads in Google Chrome and I get cached or update ready event. But once I shut down the server and refresh the page, I get an error manifest fetch fail (-1).
How to get over this error and why does it occur?
my manifest file is as follows(sample.manifest):
CACHE MANIFEST
# version 4
CACHE:
css/styles.css
js/script.js
js/jquery-latest.js
js/jquery.validate.js
img/blue-line.png
img/main-img.png
img/logo.png
img/green-li.png
img/gline2.png
img/gline3.png
img/gline4.png
img/gline5.png
img/diversity-img.jpg
img/facebook32.png
img/mail40x32.png
img/main-img-298.png
img/ppl-img.jpg
img/twitter32.png
leavevbc.html
diversity.html
NETWORK:
*
I added the correct MIME type but I'm still getting the problem.
The manifest load fail error is exactly what you have to expect if the server can't be reached. The manifest can't be loaded. It's a little bit confusing that this is reported as an error - but that's what the standard says. All you have to do is ignore the error and you should have an offline cached webapp.
In Chrome, inspect all your app cached items. You may be surprised to see that what is inside of your cached files are not what you put into them. I've run into this exact situation. I had a javascript file that contained my FALLBACK: offline.html page. The Webkit cache loader has issues when the type of content its loading is not what it expects. To me this is just wrong, but on the upside, it did reveal the problem. In my case, it looked in my js file and crimped when it saw the at the top of the file.
If there are resources that must be pulled when online only then list them in NETWORK: section.
To fix current situation do following:
clear out your browser cache
change comment at top of your manifest file so that new copy will be downloaded
fire up chrome with developer tools
pull down web page while online
inspect your chrome application cache files again
go offline and browser refresh
http://www.html5rocks.com/en/tutorials/appcache/beginner/

Firefox 'Error loading script' loading Google Analytics in FF2

The project I'm working on uses a window.onerror event handler to report user problems. I've noticed a single user that just cannot seem to load the Google Analytics script. Our site doesn't see a lot of traffic so I'm not sure how widespread this is, but so far it seems to just effect one user.
His user agent is: "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080829 Firefox/2.0.0.17".
The error message Firefox gives is: "Error loading script".
Additional note: The site references several other javascript files. However, the analytics reference is the only one to an external domain and the only script reference at the bottom of the page, just before the closing body tag.
Has anybody else run across this, or have any idea what could be the issue? Thanks!
This problem occurs when leaving a page in Firefox before all scripts have finished loading. So I assume that it is safe to ignore the error.
You don't see this error in the Firefox error console, but you can make it visible by binding an alert to the window.onerror event. Then you will be able to see the alert box for a small amount of time and get the following error in the error console:
[11:35:57.428] uncaught exception: [Exception... "prompt aborted by user" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: resource:///components/nsPrompter.js :: openTabPrompt :: line 462" data: no]
I'm using the following check to ignore this error in my onerror handler:
if (navigator.userAgent.search('Firefox') != -1 && message === 'Error loading script') {
// Firefox generates this error when leaving a page before all scripts have finished loading
return;
}
This is a rather random guess, but I wonder if the user is using an add-on like NoScript to control script execution and is not allowing scripts from Google Analytics to run. I know this is possible because it's what I do :) I don't know if that would show up as the error you're seeing.
I have a site with over 80 pages, all that employ JavaScript error trapping. My site serves well over 2000 pages a day and I get about ten "Error loading script" scripting errors each day from Firefox browsers. It is beginning to really annoy me and I am becoming convinced that it is a problem in Firefox.
I can discount the NOSCRIPT suggestion because the script loads in the head of my pages where there are no NOSCRIPT tags.
I can discount the 'external domain' suggestion because I have two sites that suffer this problem and in both cases the JS library files are located on the sites own server.
I have carefully checked every library file and web page using JavaScript Lint and I have discovered scripting errors and questionable scripting techniques. All these problems have been corrected but this has not provided any sort of cure to the "Error loading script" problem.
My pages do load several JavaScript library files that do not have this problem and the only difference is the size of the files. Most of the files are under 5KB but the problem file is 17KB.
Could the size of the library file be the problem?
Aagh!
We had the same issue and after examining our CDN logs, we discovered that Firefox triggers the onerror event when a script returns with HTTP status "304 Not Modified", so a cache hit. In fact, Firefox (tested with Firefox 12 at time of this writing), seems to trigger onerror event for all HTTP statuses except '200 Ok'. Other browsers behaved differently in our experiment: Chrome (19) triggered onerror only on '407 Proxy Authentication Required' and Opera (12) on 100, 101, 204, 4xx and 5xx.
I'm sure this is long resolved.. but to anyone who stumbles across this page: this error is triggered by firefox when an external script fails to load (it's easy to find the code that triggers this in the source code). We were catching these errors on our site and it turned out that we were returning 404s for the script, so I suggest looking at your logs as one possibly source of this error.

Categories