| Lurk all you'd like, but why not register and post some pics? Registering also makes it easier to find the good stuff. Need help? |
|
|||||||
| Register | FAQ | Shooters | Calendar | Reviews | Tutorials | Gallery | Books | Search | Today's Posts | Mark Forums Read |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
Beginner grinner
Join Date: Apr 2007
Posts: 8
|
I'm relatively naive (
) on JSON could use a couple questions answered. I am trying to build a SmugMap-like interface from blogs.sun.com/blackbox. The RSS feed has the exact information I need, but you can't load it from a web page because of the security implications (this thread documents it a bit, http://www.dgrin.com/showthread.php?...ghlight=access)So, the JSON questions I have
Paul Monday |
|
|
|
|
|
#2 |
|
Beginner grinner
Join Date: Apr 2007
Posts: 8
|
Follow-up, Chattin' with myself
In talking with a few folks here and looking around the net a bit, it looks like pure use of JSON still requires that I load the document from a different domain, thus forcing the sandbox security violation...bummer for me.
The solution, theoretically (with respect to JSON), is JSONP...but this appears to be enabled by the server side (y'all at SmugMug)... Alternatives appear to be - I could author a proxy javascript somewhere and put it on our server (not possible since I'm pure client side but is very similar to what I'm doing today anyway) - I could use some IFrame hack that I don't understand yet (and I'm not sure if I could implement in the blogging infrastructure) Still trying to figure this out though...there's got to be a more direct way to replace my current polling application on my pc that reformats info into javascript variables, uploading it to a middle-man web site and importing the .js from my client. I suspect the google maps api, while not json, is a bit more like one would expect a pure client API to be like (import a javascript library and use it directly). That's an interesting solution since, technically, it seems like you have the same so called security violation as the remote document loading ![]() Paul |
|
|
|
|
|
#3 |
|
Big grins
Join Date: Apr 2007
Posts: 18
|
You should be able to use this library to get around the cross domain security issue from your server .
http://www.xml.com/pub/a/2005/12/21/...cript-tag.html Kevin |
|
|
|
|
|
#4 | |
|
Beginner grinner
Join Date: Apr 2007
Posts: 8
|
Quote:
I believe that this is dependent on server side support. The example they use is from another JSON service. One of the parameters is a callback=javascriptobject where the javascript object can be a function. The server then wraps the JSON result in a function call so that it is called on the return of the information. Here is the example of the callback function supported in a json service: http://developer.yahoo.com/common/js...#callbackparam Here is another example in the Google service: http://googlemapsapi.blogspot.com/20...side-maps.html Is there support for a callback on the SmugMug JSON API, I didn't see it anywhere? Paul |
|
|
|
|
|
|
#5 | |
|
technicolored
|
Quote:
you don't need the callback. var oJSON = eval('(' + response + ')'); also, you might want to read this article about how to proxy xmlhttp requests to get around cross domain security. |
|
|
|
|
|
|
#6 | |
|
Big grins
Join Date: Jan 2007
Posts: 20
|
Quote:
you might want to read this article about yahoo's json api. |
|
|
|
|
|
|
#7 | |
|
Beginner grinner
Join Date: Apr 2007
Posts: 8
|
Quote:
I do NOT have access to the web server to host the proxy (i'm on blogs.sun.com and do not own the infrastructure). I am purely in the client space. Use of the callback mechanism in the Yahoo API (and Google) allows me to build a pure client rather than having to load a special proxy script on my web server. As aarone notes, by having YOUR JSON request format the callback, it calls my function, which is permitted by the sandboxes (I still don't see why since it seems like a huge security no-no...but hey, I'm going to go with it). |
|
|
|
|
|
|
#8 | |
|
technicolored
|
Quote:
Thanks....that's cool. I'm adding a JSONCallback parameter, I will let you know when it's released. |
|
|
|
|
|
|
#9 | |
|
Beginner grinner
Join Date: Apr 2007
Posts: 8
|
Quote:
Thanks David...I hate to be an anxious dork, but our new tour starts at the end of this week and I have to finish the code while I'm in the booth at JavaOne, do these type of enhancements usually take a while? Thanks, Paul |
|
|
|
|
|
|
#10 | |
|
Big grins
Join Date: Jan 2007
Posts: 20
|
Quote:
|
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|