Using HTML 5 into Html Web Resource in Crm 2011
-
Thursday, April 26, 2012 1:02 PM
Hy everyone, how are you?. Well. The case is that I need to develop a web resource that will be embeded on Form's header. This Web Resource should draw a rectangle with a label for each value of a pick list that is being showed on the form.
I tryed to use HTML 5 in order to draw the rectangles but I can't make it work properly once is included on the web resource.
I'll paste here an excample that, if it's opened normally using IE, runs normally, but opened through a Web resource embeded into the form's header doesn't work and throws an exception like : ' getContext(() is not a function or property'
Here is the code
var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); var xpos = -50; debugger; for (var ii = 0; ii < 3; ii++) { xpos += 50; ctx.fillStyle = "#FF0000"; ctx.fillRect(xpos, 1, 50, 50); ctx.fillStyle = "#000000"; ctx.font = "10px Arial"; ctx.fillText("Stage ", xpos+5, 25); }Question: Can I draw in crm using HTML 5 into a web resource????
Thanks in advance!
All Replies
-
Thursday, April 26, 2012 2:10 PM
Hi,
Please have a look at the post below regarding the same issue:
http://stackoverflow.com/questions/8224116/ms-dynamics-crm-web-resources-html-and-custom-doctype
I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
Ashish Mahajan, CRM Developer, CSG (Melbourne)
My Personal Website: http://www.ashishmahajan.com
My Blogs: http://ashishmahajancrm.blogspot.com.au and http://ashishmahajancrm.wordpress.com
My Youtube Channel: http://www.youtube.com/user/ashishmahajanmscrm
My Twitter: https://twitter.com/#!/ashishmahajan74My Linkedin: 
- Proposed As Answer by Ashish Mahajan Australia (Architect) Thursday, April 26, 2012 2:10 PM
-
Thursday, April 26, 2012 2:40 PM
Hi Ashish!,
Thanks for your help. According with the post you have referenced I did the following:
•I went to my Html Web Resource
•I Uploaded the same html file that is working great outside crm
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <canvas id="myCanvas" width="200" height="100" style="border: 1px solid #c3c3c3;"> Your browser does not support the canvas element. </canvas> <script type="text/javascript"> var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); var xpos = -50; for (var ii = 0; ii < 3; ii++) { xpos += 50; ctx.fillStyle = "#FF0000"; ctx.fillRect(xpos, 1, 50, 50); ctx.fillStyle = "#000000"; ctx.font = "10px Arial"; ctx.fillText("Stage ", xpos + 5, 25); } </script> </body> </html>
Despite of having done all these things, the same issue is happening:
When this line is executed:
var ctx = c.getContext("2d");the following error is being showed:
Microsoft JScript runtime error: Object doesn't support property or method 'getContext'
Has someone an idea of how to solve this??
Thanks!!!!!
-
Thursday, April 26, 2012 2:46 PM
Hi,
CRM 2011 is not yet multi-browser compatible. It only runs in IE.
There is a service update coming soon which will make it run in most of the latest browsers. I assume, the HTML5 based web resources should be fully compatible with CRM 2011 then.
Till then, can you re factor your web resource to make it compatible with the current CRM 2011.
I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
Ashish Mahajan, CRM Developer, CSG (Melbourne)
My Personal Website: http://www.ashishmahajan.com
My Blogs: http://ashishmahajancrm.blogspot.com.au and http://ashishmahajancrm.wordpress.com
My Youtube Channel: http://www.youtube.com/user/ashishmahajanmscrm
My Twitter: https://twitter.com/#!/ashishmahajan74My Linkedin: 
- Proposed As Answer by Ashish Mahajan Australia (Architect) Thursday, April 26, 2012 2:46 PM
- Marked As Answer by SantiagoProxy89 Thursday, April 26, 2012 5:15 PM
-
Thursday, April 26, 2012 2:51 PM
Thanks Ashish,
I believe that I'll have to find another way to do the same without using HTML 5 .
THanks a lot and I'll be looking forward that service update!.
-
Wednesday, October 10, 2012 5:12 PM
Hi,
When will HTML5 support be available? This post is quite old and our version of Dynamics CRM (5.0.9690.2730) doesn't support it.
Regards,
Tom
-
Wednesday, May 08, 2013 6:33 PM
I suspect this is CRM issue, If the CRM that you are running in IE 8 then IE8 doesn't support canvas natively.
You can use explorercanvas add canvas functionality to IE8. All you have to do is include the
excanvas.jsfile in your page.Google hwo to use Canvas in IE8.
You can try your same code in CRM running under IE9.
Thanks.
Puneet Joshi - Dynamics CRM Developer

