I appreciate that it works in practice, but it's really not an ideal
approach because (1) it does not address the issue of desktop local
testing - it's often highly desirable to test using the desktop
browser's javascript debugger and you're not going to want to move the
phonegap.js file just for this, (2) you get lots of spurious error
messages in your browser error console and web server logs, and (3)
it's prone to error, you might upload phonegap.js by mistake unless
you're using a scripted build and deploy mechanism, but then, why
should you layer another such mechanism when there are already such
mechanisms in your IDE?
For now, I've solved the problem by setting a global variable in the
webViewDidStartLoad method of PhoneGapDelegate.m, however, according
to
http://stackoverflow.com/questions/3509098/ this might have
problems. On the plus side, modifying webViewDidStartLoad let me get
rid of the odd movie loading code that's in there right now.
If the idea of hiding the phonegap.js file is the way to go, then I'd
suggest adding a build phase script in the Xcode app target build at
the end that deletes the phonegap.js file from the www directory,
since at the beginning of the target build, there's already a build
phase script that copies a fresh copy of phonegap.js file into the www
directory from the PHONEGAPLIB directory. That way, there's much less
risk that a copy of phonegap.js gets copied onto a production web
server or loaded during desktop browser-based testing.
Ed