Hi, after some hours I found a way to log script events or errors in
FF2
and IE6 using either Firebug or GLog or "something" (alert for
errors) .
As it's only twenty lines of code I thought I share it here. Near the
top
after google.load sent its success report:
this.alert = mylog( this, 1 );
this.debug = mylog( this, 0 );
this.debug( "API 2." + G_API_VERSION " loaded" );
[...skipping the actual application...]
function apply( object, method )
{ return function()
{ return method.apply( object, arguments );
} }
function mylog( object, error )
{ var method = function () {};
( error && typeof console != "undefined" &&
isfun( console.error )) ||
( typeof console != "undefined" &&
isfun( console.debug )) ||
( error && typeof google != "undefined" &&
isfun( google.maps.Log.write )) ||
( error && isfun( alert )) || isfun( window.dump );
return apply( object, method );
function isfun( fun )
{ if ( typeof fun != "function" ) return false;
return method = fun; /* true => method set */
} }
With FF2 + firebug the line number is the line of method.apply,
I can live with that. With IE6 the missing firebug console does
not trigger an error. Any this.debug() is silently ignored in IE6.
Errors reported by this.alert(), e.g., after getEarthInstance fails,
are shown by GLog.write if no console is available. This is only
a gimmick, in production code I'd remove the GLog.write line.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---