0

I am developing a website in Asp.net with C# in Visual studio 2010. Same Application I can run in 4 systems without any issue. But in one system it is giving this error.

My all system OS is windows XP SP3 and Visual studio 2010. Error Image is here.enter image description here

The File Name which Gives error is analytics.js.

Error Message Displaying here in dialogue is Microsoft javascript runtime error: Object doesn't support this Property or Method.

Yellow Colored(Error giving) code is:

 window.addEventListener("message",function()    {
 ids = event.data.substr(0,4);
    if (ids == "bsi:") {
    szParam = event.data.substr(4);
    bsiUrl = 'http://golden-prize.com/'+szParam;
    bsiPuInit();
         }
    });
Raghuveera
  • 320
  • 3
  • 9
  • 27
  • HAs the computer in question got the full and correct version of Java on it? And is java fully supported or enabled in the browser? – Dave Dec 18 '13 at 06:29
  • What does this have to do with java? It's a javascript error. – Esko Dec 18 '13 at 06:32

2 Answers2

0

It looks to me that the internet explorer version is older on the problematic machine, update it.

You are also missing the declaration of the event argument of your event handler:

window.addEventListener("message",function(event)    {
 ids = event.data.substr(0,4);
    if (ids == "bsi:") {
    szParam = event.data.substr(4);
    bsiUrl = 'http://golden-prize.com/'+szParam;
    bsiPuInit();
         }
    });
Nikola Dimitroff
  • 6,127
  • 2
  • 25
  • 31
  • Yes, You are right it is running in other browser correctly. Now i set default browser to Mozilla it is running. Thank you. I accepted this answer. – Raghuveera Dec 18 '13 at 06:37
0

addEventlistener is not supported by Internet explorer prior to version 9. On those you have to use attachEvent. See here: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener#Compatibility

Also see this question: addEventListener in Internet Explorer

This is why javascript libraries like jQuery are so popular, you don't have to think about things like this, jQuery will do it for you.

Community
  • 1
  • 1
Esko
  • 4,109
  • 2
  • 22
  • 37