Does JSONP scale? How many JSONP requests can I send?

Posted by Cheeso on Stack Overflow See other posts from Stack Overflow or by Cheeso
Published on 2010-03-15T12:57:20Z Indexed on 2010/03/15 12:59 UTC
Read the original article Hit count: 485

Filed under:
|

Based on Please explain JSONP, I understand that JSONP can be used to get around the same-origin policy.

But in order to do that, the page must use a <script> tag.

I know that pages can dynamically emit new script tags, such as with:

<script type="text/javascript" language='javascript'>

  document.write('<script type="text/javascript" ' + 
                 'id="contentloadtag" defer="defer" ' +
                 'src="javascript:void(0)"><\/script>');
  var contentloadtag=document.getElementById("contentloadtag");
  contentloadtag.onreadystatechange=function(){
    if (this.readyState=="complete") { init(); }
  }
</script>

(the above works in IE, don't think it works in FF).

... but does this mean, effectively, that every JSONP call requires me to emit another <script> tag into the document? Can I remove the <script> tags that are done?

© Stack Overflow or respective owner

Related posts about JSON

Related posts about jsonp