0

I have an error on my site triggered by Internet Explorer 8 when I first enter the page. The debugger says:

Object doesn't support this property or method

widget, line 48 character 3

I click on the error to take me to the line. It leads me to HTML. How is it possible that HTML triggered a JS error?

html

I have not clicked this anchor. The error appeared upon page load. Can someone give me leads on where I should be looking to find the real problem?

Live site: http://veetle.com/index.php/widget#3D598BC5A2144C53D2797CF7EDEF083A/true/default

JoJo
  • 19,587
  • 34
  • 106
  • 162
  • Your HTML contains JavaScript code inside the href and onclick attributes, and this JavaScript code can throw and Error, yes. – Šime Vidas Feb 11 '11 at 20:38
  • Place your Javascript code in external files, that is the only way I can make IE throw valid line number for errors. – mhitza Feb 11 '11 at 20:46
  • But you have to click the anchor to trigger the onclick handler. I never clicked it. – JoJo Feb 11 '11 at 20:51

1 Answers1

2

This is probably the source of the issue:

onclick="VEETLE.Players.instance().getPlayer().togglePlayer(); return false"

The reason for the error is probably the VEETLE object not being defined yet.

Try placing the SCRIPT that defines that object into the HEAD of the page.


Consider this:

var po = document.getElementById('playOverlay');

po.onclick = function() {
    VEETLE.Players.instance().getPlayer().togglePlayer();
    return false;
}

... instead of the onclick attribute.

Šime Vidas
  • 182,163
  • 62
  • 281
  • 385
  • @JoJo It could be that the ANCHOR was clicked programmatically (via `click()`). Try removing the href attribute and see if the Error persists... – Šime Vidas Feb 11 '11 at 20:47
  • I did a search on my code and I didn't call **click()** on that anchor. – JoJo Feb 11 '11 at 20:54
  • @JoJo Let's first make sure that the onclick attribute is really the cause of the error. Remove it - does the erorr persist? – Šime Vidas Feb 11 '11 at 21:01
  • I removed the entire anchor tag. The error still says line 49, character 3 of the HTML. Of course, now it's pointing to the HTML below the original position of the anchor tag. This HTML, however, does not have any JS handlers. I'm starting to think that the IE debugger is just erroneously pointing to some random line in the HTML, when it should be pointing to JS. – JoJo Feb 11 '11 at 22:46
  • @JoJo Hm, I'll have to open your page in IE8 to see what exactly is going on there (I only have IE9 RC on this machine). I'll do that tomorrow, remind me if I forget `:)` – Šime Vidas Feb 12 '11 at 00:26
  • I don't care anymore. IE blows. I'll just mark this as the answer because so no one wastes their life on this question. – JoJo Feb 15 '11 at 23:33