5 ms·
I'm curious: how do you get around crossdomain XHR limitations using <script> tags? Thanks!
by shajith 16y ago
I'm curious: how do you get around crossdomain XHR limitations using <script> tags? Thanks!
- feross 16y ago<script> tags aren't subject to cross-domain restrictions. Think about it - all those website statistics scripts are hosted on external servers, but their Javascript gets executed just fine. By dynamically inserting <script> tags into the page, you can force Javascript from another domain to execute in your domain.
- shajith 16y agoGot it, thanks. I finally got around to learning JSONP. JQuery's $.ajax API handles it automatically for you too (if you use the 'jsonp' or 'script' dataType options), which is very nice.