[mythtv-users] JSONP callback support in the new services API in .25

Patrick Archibald patrick.archibald at gmail.com
Fri Jan 18 16:01:55 UTC 2013


On Tue, Jan 17, 2012 at 6:13 PM, Patrick Archibald
<patrick.archibald at gmail.com> wrote:
> On Tue, Jan 17, 2012 at 4:18 PM, Raymond Wagner <raymond at wagnerrp.com> wrote:
>> On 1/17/2012 14:51, Patrick Archibald wrote:
>>> I am running into the "same origin policy" roadblock while
>>> trying to use them in a web app. Would anyone else like to
>>> see Javascript callback function support (JSONP) added?
>>
>> I understand the problem that JSONP is trying to solve, I just
>> completely disagree with that solution.  Executing JSON directly,
>> without passing through the sanity checks of a parser, just sounds like
>> a recipe for disaster.  Surely there is a better solution available.
>> Wikipedia mentions that HTML5 has a 'postMessage' mechanism that gets
>> rid of the problem entirely.
>>
>> Alternatively, chances are very good your backend and webserver are at
>> least on the same network, if not the same host.  Why not have whatever
>> web application you are writing, that needs to provide its own data
>> independent of the Services API, just proxy those requests to the
>> backend?  That way, everything appears to be coming from the one host?
>
> Hi Raymond,
>
> The "same origin policy" says the port has to be identical too. That
> rules out having a web app on a backend server using only Javascript
> and JSON. I started off writing my app in Java/GWT which runs on a web
> application server like Tomcat or Jetty. After a few hours of creating
> object classes, http and data transform methods it dawned on me that
> all this could be accomplished with a single HTML/Javascript/JSONP
> page. If I end up creating something worth sharing, folks would be
> more likely to install it if it were one HTML/Javascript file VS.
> installing Java, installing Tomcat or Jetty, deploying my web app from
> a .war file.
>
> The new Services API is great and I want to see it used as widely as
> possible. Being able to specify a Javascript callback function would
> enable web developers to create some powerful light-weight web apps.
> Why not wrap the JSON response in a function call when the developer
> requests it?
>
> Thanks, PLA

To cap this old thread off. node-webkit avoids the "same origin
policy" roadblock and can consume JSON data from the services API.

Here is a demo of my first app: http://youtu.be/Ht6QL_vEJq0

Rock on, PLA

Patrick L Archibald
http://PatrickArchibald.com


More information about the mythtv-users mailing list