TypeError: invalid ‘in’ operand obj

A weird JavaScript error that you may face when using Dojo Ajax for retrieving some JSON data from the server to render on the browser. This error happens because Dojo is unable to process the resulted JSON data which is the case when handleAs attribute is set to “text”.

In order to fix this error, set handleAs attribute to “json” instead of “text” as shown below in the example:

	url: '/SomeServlet',
	handleAs: "json",
	timeout: 3000,
	load: function(data) { /* Success Handling */ },
	error: function(err) { /* Failure Handling */ }

This is my today’s two cent advice.

Uncaught TypeError: Object #<a Document#> has no method ‘write’

Error Conditions:
This issue happens when you use GMaps4JSF with Google Chrome (also Safari) in Facelets XHTML files (The default PDL for JSF 2.0). Actually this issue generally happens when you make make any include to Google Maps inside XHTML files:

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAxrVS1QxlpJHXxQ2Vxg2bJBQdkFK-tWRbPPQS4ACM1pq_e-PltxQXeyH20wQuqDaQ_6EM5UeGGVpnIw"> </script>

Just set the content type to “text/html”:

<f:view contentType="text/html">