0
votes

I'm creating an HTML web-resource for CRM 2011 that is suppose to produce a custom graph. It works great on my local machine, but as soon as I put it into the CRM 2011 Solution, I get a JavaScript error on the line where I call getContext() on an element.

I've even gone so far as strip the code down to the most basic elements, and it still produces this error in CRM. Does anyone have any ideas? You can see the stripped down code below.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
<div style="width: 50%">
    <canvas id="myChart" width="400" height="300"></canvas>
</div>

<script>

    function loadData(dataSet) {

        var c = document.getElementById("myChart");
        var ctx = c.getContext(); //THIS IS THE LINE PRODUCING THE ERROR, BUT ONLY IN CRM 2011!!!
    }

    window.onload = function () {
        loadData(1);
    }
</script>
</body>
</html>
1
which browser you are using? - Guido Preite
Internet Explorer 8.0.7601.17514 - Cailean
IE8 doesn't support the canvas object, for this you get the error - Guido Preite
Ah.. that's what it is. The environment that I'm working with has different versions. My development box has IE11, but the CRM setup is on the Test Network which has IE8. That's why it works for me locally, but not in CRM. Thanks! - Cailean

1 Answers

2
votes

Turns out it's because the CRM environment that I'm using has IE8, which does not fully support HTML5. My development machine has IE11 installed, which is why it worked for me while developing the solution.

I just spoke to our network guys, and they're going to try to have IE upgraded on the CRM boxes as soon as possible.


Just a quick update, after having IE upgraded to 11 and installing quite a few service packs, I opened up CRM 2011 and it went into Mobile mode. We had to assign the domain name to the Compatability View list and that made it behave normally again. With that though, I had to add the following line to the HTML in order for the HTML5 to behave properly again:

<!DOCTYPE html>
<meta http-equiv="X-UA-Compatible" content="IE=Edge"> <!-- this is the line that was added -->

Hopefully this will help anyone else down the road.