Posts Tagged ‘Same Origin Policy’

A weather forecast WebPart using JSONP

Weather-WebPart-teaser

My previous post shed some light on JSONP and how it works. In this post I will describe how to create a cool SharePoint 2010 WebPart that shows weather forecasts. The actual forecast data is retrieved from the Yahoo Weather Service  using a JSONP call.

(more…)

Cross-domain webservice calls using JSONP

JSONP-teaser

The JavaScript class library for SharePoint 2010 enables developers to create rich SharePoint applications using pure JavaScript. If combined with the jQuery library, the power of JavaScript solutions is limitless,….. or isn’t it.

The Same Origin Policy prevents access to resources on other domains. Put simply; you cannot call a webservice from JavaScript that is hosted on another domain. There is however one exception to this claim; browsers allow the <script>-tag to call JavaScript files that are hosted on another domain. The technique JSONP exploits this opportunity.

(more…)