Skip to main content
Home Forums Silverlight Programming Programming with JavaScript downloader and same-origin-policy
1 replies. Latest Post by Wolf Schmidt (MSFT) on July 16, 2009.
(0)
DonDozone
Member
0 points
7 Posts
07-10-2009 1:16 PM |
Hi there, I'm wondering if the "downloader" object of Silverlight 1.0 is also restricted by Javascripts' "same-origin-policy"? I'm currently developing a Silverlight-gadget for IGoogle and try to show there pictures, which come from a different domain. I check the status from the "DownloadFailed"-Event and it says: Status:204 HTTP:NO CONTENT but the URL is perfectly okay and it worked in the Sidebar version of the gadget. I read in the MSDN-documentation, that the source has to come from the same host as the gadget. Is there a way to surpass this restriction? I really need the downloader object, because i have to determine the exact time, when the download of the image has finished. When i use silverlightobject.Source = "http....", I have no control about when the image is rendered. Any help appreciated.
Wolf Sch...
489 points
79 Posts
07-16-2009 3:42 PM |
Downloader does not restrict its Get URLs to come from the same host/ site of origin as the calling plug-in. Putting an http:// request to download from another SOO should work fine for an image. But there are other things you might be running into.
* Your image source site might have a client policy in place to restrict cross domain requests. Silverlight downloads respect the client policy, I'm not sure what sidebar does.
* I'd expect a different error for this, but maybe the image format isn't Silverlight compatible?
* How are you testing this - using localhost? Downloader requests do have to come from same SCHEME, so if you are testing by double-clicking and thus using file://, you will get DownloadFailed, as well as a AG_E_NETWORKERROR