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

3
  • Your HTML contains JavaScript code inside the href and onclick attributes, and this JavaScript code can throw and Error, yes. Commented Feb 11, 2011 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. Commented Feb 11, 2011 at 20:46
  • But you have to click the anchor to trigger the onclick handler. I never clicked it. Commented Feb 11, 2011 at 20:51

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

6 Comments

@JoJo It could be that the ANCHOR was clicked programmatically (via click()). Try removing the href attribute and see if the Error persists...
I did a search on my code and I didn't call click() on that anchor.
@JoJo Let's first make sure that the onclick attribute is really the cause of the error. Remove it - does the erorr persist?
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 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 :)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.