Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript error in every page on IE 10

My asp.net site is running well on IE6, IE7, IE8, IE9, Chrome, Safari, Firefox and Opera. But it is not working at all in IE10.

If I click anywhere in the site (any button, any link, etc) it returns the following error:

SCRIPT5022: Sys.ArgumentOutOfRangeException: Value must be an integer.
Parameter name: x
Actual value was 5.999999523162842. 

JS things, like tabs, doesnt work due to this problem. I tracked down the problem and it is in MicrosoftAjax.js , specifically in the following method.

Sys.UI.Point = function Sys$UI$Point(x, y) {
    /// <param name="x" type="Number" integer="true"></param>
    /// <param name="y" type="Number" integer="true"></param>
    /// <field name="x" type="Number" integer="true"></field>
    /// <field name="y" type="Number" integer="true"></field>
    var e = Function._validateParams(arguments, [
        {name: "x", type: Number, integer: true},
        {name: "y", type: Number, integer: true}
    ]);
    if (e) throw e;

    this.x = x;
    this.y = y;

It works on all other IE versions since 6, which is quite a fate.

I know that HTML is only supported by real browsers, leaving out Internet Explorer, but my client really wants the site to work in IE10.

Just to be clear, it works well in ie6 to 9, chrome, firefox and opera. None of them show javascript errors, just ie10, and this error comes up on every click. I copule not track who is calling this method. This is a big site and none of the js code that i use is calling it. I think that probably MicrosoftAjax.js framework has bound the click event and it is executing something but i am not sure what it is executing.

Can anyone help me?

like image 950
Tony Avatar asked Dec 26 '12 22:12

Tony


2 Answers

I found a nice solution blogged by Yuriy:

<script language="javascript">
    Sys.UI.Point = function Sys$UI$Point(x, y) {

        x = Math.round(x);
        y = Math.round(y);

        var e = Function._validateParams(arguments, [
            {name: "x", type: Number, integer: true},
            {name: "y", type: Number, integer: true}
        ]);
        if (e) throw e;
        this.x = x;
        this.y = y;
    }
</script>

Paste this on your page to override the Sys$UI$Point function to round the numbers.

Or, set <compilation debug="false">

Either of these worked for me.

like image 190
Mafu Josh Avatar answered Oct 08 '22 12:10

Mafu Josh


The answer is in the following link:

http://support.microsoft.com/kb/936993

I had to change Microsoft.Ajax.js.

like image 44
Tony Avatar answered Oct 08 '22 14:10

Tony