1

I am developing a game(using html5, createJS,Canvas) which is loading successfully on wamp servr locally, but it generate error on web server as below.

Uncaught Error: NotSupportedError: DOM Exception 9 prototype.js:1263
document._getElementsByXPath prototype.js:1263
document.getElementsByClassName prototype.js:1272
a jquery-1.9.0.min.js:2
st.fn.extend.find jquery-1.9.0.min.js:2
st.fn.st.init jquery-1.9.0.min.js:1
st jquery-1.9.0.min.js:1
(anonymous function) index.php:95
f jquery-1.9.0.min.js:1
p.fireWith jquery-1.9.0.min.js:1
st.extend.ready jquery-1.9.0.min.js:1

What may be the cause ?

Thank Anil Kumar

Christoph
  • 50,121
  • 21
  • 99
  • 128
neel dhara
  • 51
  • 1
  • 8

1 Answers1

1

I had the same problem and was getting "NotSupportedError: DOM Exception 9" from cordova app on ios while the code worked fine in desktop Safari & Chrome. I was accessing an SVG element, with element.children[0].children[0] & element.children[0].children[1]. Element was a containing div; children[0] was svg; and children[0] & children[1], rect and text, respectively.

The DOM appeared to be correctly constructed.

Turns out that in some environments, in my case mobile Safari, SVG is treated ONLY as XML, therefore you need to access with...

element.getElementsByTagName('rect')[0];
element.getElementsByTagName('text')[0];

All was fine thereafter.

Rafa Viotti
  • 9,998
  • 4
  • 42
  • 62
user3094755
  • 1,561
  • 16
  • 20