Login Register

Module loader confused by non-standard port in Safari Mobile

I'm working on a remote debugger for the iPhone using dojox.cometd and the module loader is getting confused in Safari Mobile because my dojo library is served from the embedded Jetty server in my application, which runs on a non-standard port.

The main JS of my pages is served via Apache on port 80. To use my debugger, I include my JavaScript library from an absolute URL, which includes a non-standard port number. For example:

<script src="http://myserver.webhop.org:8170/mylib.js"></script>

This is a stub file which does a scriptaculous-like include of dojo and the real JavaScript library file like so (desktop browsers work fine with relative URLs, but as I point out later, Safari Mobile seems to be broken in this regard...I've tried adding baseUrl and it doesn't seem to make any difference):

if(typeof dojo == "undefined") {
	djConfig = {
		baseUrl: "http://myserver.webhop.org:8170/lib/dojo/",
		usePlainJson: true
	}
	document.write('<script src="http://myserver.webhop.org:8170/lib/dojo/dojo.js"></script>');
}
document.write('<script src="http://myserver.webhop.org:8170/_mylib.js"></script>');

When I do a dojo.require("dojox.cometd") in my library code, Safari Mobile errors out with an error that it can't find "../dojox/cometd.js". It seems that, in Safari Mobile, the non-standard port number is NOT included in the generated URL when using relative paths. So it's actually trying to load:

http://myserver.webhop.org/lib/dojox/cometd.js

which obviously won't work.

I can't use a base tag because the guts of the application I'm debugging shouldn't know anything about the dojo stuff tucked away in the Jetty server.

Can I configure dojo to work around this apparent bug in Safari Mobile? I've looked in the _getText method and it is not checking for any kind of configuration parameters that need to be prefixed to the relative module load path (like baseUrl).

This works fine from desktop browsers, by the way. I just seem to have this issue with Safari Mobile.

Thanks!

Jon Brisbin
http://jbrisbin.com