Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #16826

Re: ajax and jsonp and mobile

Message-ID <3451959.NK5rUynJWR@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-10-24 01:45 +0100
Subject Re: ajax and jsonp and mobile
Newsgroups comp.lang.javascript
References <UYmdnaH3qI_a8B3NnZ2dnUVZ_tWdnZ2d@westnet.com.au>
Followup-To comp.lang.javascript

Followups directed to: comp.lang.javascript

Show all headers | View raw


Andrew Poulos wrote:

> AFAIK
> 
> AJAX

That is a misnomer which leads to misconceptions.  Forget about it.

> - not cross domain

Not necessarily.  You can allow that now with a header field.  See the other 
answer.

> - has error handling

Not necessarily.  There are errors that cannot be handled.
 
> JSONP
> - cross domain

Not necessarily.  You can forbid that based on the Referer (sic!), but it 
can be circumvented.

> - no error handling

Not necessarily.  You can add error handling.

> - insecure

Not necessarily.  HTTP over SSL/TLS can be used the same as it can with XHR.

> - adds javascript elements to the page

No, it adds `script' elements to an (X)HTML document.  That is where that 
technique is inherently unreliable, because AFAIK there still is no 
(quasi-)standard specifying what is supposed to happen then.  Proper tests 
are pending.
 
> Both can return the same "data"

No.  A script inserted with JSONP can include code that is compiled and 
executed immediately.  A script returned from XHR needs to be 
inserted/evaluated before it is executed.

> and in my testing I couldn't find any real speed differences between the
> two.

Test more.

> If I'm writing a mobile app in HTML5 which needs to talk with a
> web-based database. Is JSONP the only option?

No.


PointedEars
-- 
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
  -- Richard Cornford, cljs, <cife6q$253$1$8300dec7@news.demon.co.uk> (2004)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

ajax and jsonp and mobile Andrew Poulos <ap_prog@hotmail.com> - 2012-10-19 07:57 +1100
  Re: ajax and jsonp and mobile Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-10-19 00:23 +0200
  Re: ajax and jsonp and mobile Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-10-24 01:45 +0100

csiph-web