Description
As described in this link ( http://samritchie.net/2011/04/01/uncaught-illegal-access-exception-in-android-browser-on-json-parse/ ), old native android browsers will trigger an error when the native "parse" method is called passing a null argument instead of a JSON string.
I have met such error using jquery-migrate library on an Android 2.3
To be fully compatible I just modified the "jQuery.parseJSON" method to return null instantly if the argument is null instead of calling the origina parse method.
Here the fixed code:
// Let $.parseJSON(falsy_value) return null
jQuery.parseJSON = function( json ) {
if ( !json && json !== null ) {
migrateWarn("jQuery.parseJSON requires a valid JSON string");
return null;
}
//Commented original return function
//return oldParseJSON.apply( this, arguments );
return ( json === null ? json : oldParseJSON.apply( this, arguments ) );
};
Hope it can be usefull for other people!