Mike,

> XMLHttpRequest can *not* be used cross-domain.


>You can put any piece of executable JavaScript code in a file, and load and
>execute it cross-domain.

I think that's somehow exactly that, what I said, or? :)

Neve rmind. Made it run. The things are running now as follows:

1) User calls initial ASPX page ("entry.aspx"). Server renders HTML and 
JS from ASPX.
2) body.onload is pointing to a small script, setting up the initial and 
blank map as usual. The same script "injects" the <script> required for 
querying the server using "query.aspx" with a bogus (cache problem) and 
a callback parameter. I abandoned the static approach here (chicken and 
egg problem: The <script> executes, while the body is not completely 
rendered, hence the map isn't there yet). With the "JS on demand" I 
ensured, that the map object is already present, when the server call is 
executed.
3) The server returns JSONP with the callback as explained in a 
fantastic manner by you
4) The callback finalizes the map with the markers returned by JSON, 
center, zooms, and so on.

Everything is fine with FF, IE and Chrome.

Just a word to Jürgen: I think, "hang" is the wrong term for what 
happens, if either the server isn't there or faulty (500 or 404 or 
whatever fault). It is "just the ordinary web behavior": Parts of pages 
or complete pages do not render correctly. In my case just the map area 
remains gray. Because i think, that an alert, giving some generic error 
message, does not improve that worse situation significantly. I would 
rather tend to leave it, as it is with a missing or faulty callback. I 
think a user is much more trained to accept missing parts of a page from 
his or her experience, than bad error messages :) And finally I bet, 
Google is blaimed for the missing map, not me... ;)

Regards





Michael Geary schrieb:
>>> From: Neil.Young
>>>   
>>>       
>> OK. Thanks Mike, this was a very interesting lesson. But what 
>> about the "not cross-domain" claim?
>>     
>
> Glad to help. Let's break it down a bit more.
>
> The cross-domain question is really completely separate from the data
> format.
>
> The bottom line is:
>
> XMLHttpRequest can *not* be used cross-domain.
>
> Script tags and dynamic script elements *can* be used cross-domain.
>
> You can put any piece of executable JavaScript code in a file, and load and
> execute it cross-domain.
>
> A JSON object by itself is not executable JavaScript. It is a valid
> JavaScript object, but you need something more to make it directly
> executable: perhaps a variable assignment as you used, or a function call.
>
> JSONP is merely a popular convention for turning a JSON object into
> executable JavaScript code, by wrapping it in a function call.
>
> -Mike
>
>
> >
>   

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to