Fritz45
Fritz45

Reputation: 782

Internet Explorer and Visual Studio 2008 error with document.createElementNS

I have a project in Visual Studio 2008 with some html pages and JavaScript. My IE suddenly started to behave strangely when I run the project to debug. Even on a simple HTML page, if I put for example a JS function like this:

function test() {
    var svgNS = "http://www.w3.org/2000/svg"; 
    var mySvg = document.createElementNS(svgNS, "svg");
    alert("Done!"); 
}

I suddenly get this error when I run the page in IE: "Microsoft JScript runtime error: Object doesn't support property or method 'createElementNS'". I get the same error if I try to use the canvas on the cal to .getContext2d. If I debug and examine the document object I can see for example the method createElementNS, but calling it gives the above error.

When I make Chrome my default browser and run the page from Visual Studio, I do NOTget any error. Also, when I put the page on a web server, I can view it in IE without an error! I am completely baffled. It seems as if my IE and Visual Studio combination is somehow broken.

I am hoping someone has run into something like this before and will appreciate any help.

Upvotes: 2

Views: 824

Answers (1)

VaclavD
VaclavD

Reputation: 2622

Which version of IE are you using? Debugging a page in IE8 with VS2008 is implemented very hacky. createElementNS is supported since IE9. I think IE8 supports SVG only as a pure SVG document. You can mix HTML with SVG since IE9.

Upvotes: 2

Related Questions