Image is undefined error only in some browsers.

Image is undefined error only in some browsers.

by Bob Ridge-Stearn -
Number of replies: 6

Forgive me if this has been asked/answered before, I had a quick search but couldn't find it exactly and I'm in a big rush.

Our college has IE8 on all PCs. On some a multiple choice quiz (JQuiz) displays correctly while on others the quiz does not open and we get this error message:

'Image' is undefined

Copying the error message gives this additional info:

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Tue, 6 Oct 2009 08:52:36 UTC
Message: 'Image' is undefined
Line: 866
Char: 3
Code: 0
URL: {our moodle server}

I'm guessing it is a browser issue but can't see what's different about the browsers. I dont have access to the Hot Pot file only the output htm file.

Any ideas?

Bob.

Average of ratings: -
In reply to Bob Ridge-Stearn

Re: Image is undefined error only in some browsers.

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi Bob,
could you hunt around in the source file for the place where "Image" is used in the javascript? It might be around line 866, but often in IE the line numbers are not much help.

If you don't understand what I am talking about or your "big rush" seems likely continues for a while, please send me (gordon at kanazawa hyphen gu dot ac dot jp), or attach to your next post to this forum, an html file containing a copy of the source of the quiz page as it appeared in the browser.

thanks
Gordon
In reply to Gordon Bateson

Re: Image is undefined error only in some browsers.

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Bob,
this might be related:

Is the quiz being displayed in a popup window?

I think the line of code that is causing you problems is in the following function:
  • function PreloadImages(){
    var a = PreloadImages.arguments;
    for (var i=0; i<a.length; i++){
    Imgs[i] = new Image();
    Imgs[i].src = a[i];
    }
    }

Which for reference comes from hp6utilities.js_.

You could try changing the fourth line to:

  • Imgs[i] = (window.Image ? new Image() : document.createElement('img'));

Try the above modification and let me know how you get on. And please send over the html file if you have a minute.

thanks
Gordon

In reply to Gordon Bateson

Re: Image is undefined error only in some browsers.

by Bob Ridge-Stearn -
Thanks for the messages. I've come to the conclusion it has something to do with IE8's response to popups as the tutor who cannot open the quiz from a Moodle link can do so if I email him the same link. I'm waiting for his response to 3 different links I''ve set up in Moodle (ie forcing download, opening in same window and a hardcoded url). I can't replicate the problem so am waiting. In meantime, I'll edit the page as you outlined and see if he can open that. Thanks for your very fast response. Bob
In reply to Bob Ridge-Stearn

Re: Image is undefined error only in some browsers.

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
I have set up a link to a file below to test if IE8 can detect the Image object in a popup wndow.

Please click the following link with IE8 and report what message you see:

My IE8 can detect the Image object OK, so there might be other conditions that need to exist before the error appears.

thanks
Gordon

In reply to Gordon Bateson

Re: Image is undefined error only in some browsers.

by Bob Ridge-Stearn -

Hi Gordon,

Sorry for the delay.  I came back to the forum to thank you and explain that the tutor has not got back to me despite various prompts to say if it now works.  As you know, I can't replicate the problem on my PC and nor can my colleagues.

Anyway, I must now report that I cannot open your link (of course you may have disabled it by now). (Bear in mind that i did not have a problem - only my colleague did).

I see:

Internet Explorer cannot display the webpage.
This problem can be caused by a variety of issues, including:

  • Internet connectivity has been lost.
  • The website is temporarily unavailable.
  • The Domain Name Server (DNS) is not reachable.
  • The Domain Name Server (DNS) does not have a listing for the website's domain.
  • There might be a typing error in the address.
  • If this is an HTTPS (secure) address, click Tools, click Internet Options, click Advanced, and check to be sure the SSL and TLS protocols are enabled under the security section.

In reply to Bob Ridge-Stearn

Re: Image is undefined error only in some browsers.

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Sorry about that Bob. I messed up with the link.

However, I have fixed it now so please try again, and even more importantly perhaps, please ask the tutor who originally reported the problem to try the link

best regards
Gordon