[IronPython] Silverlight and Catching HttpWebRequest Errors
Michael Foord
fuzzyman at voidspace.org.uk
Mon May 12 23:10:50 CEST 2008
Jimmy Schementi wrote:
>>>> def download(url):
>>>> request = HtmlPage.Window.CreateInstance("XMLHttpRequest")
>>>> request.Invoke("open", "GET", url, false) # false means
>>>>
>> synchronous
>>
>>>> request.Invoke("send", "")
>>>> return request.GetProperty("responseText")
>>>>
>>>> :)
>>>>
>>>>
>>>>
>>> Is that cross-browser?
>>>
>>>
>> Well, it works on Firefox. Cool.
>>
>> Michael
>>
>>
>
> Works in IE7-8 as well. There's of course cases while using XMLHttpRequest where you have to do browser-specific things, but this little chunk of code will work cross-browser
>
Unfortunately my use case is for doing a cross-domain POST, so
XMLHttpRequest doesn't work at all. I'll try and get HttpBrowserRequest
working.
Michael
http://www.ironpythoninaction.com/
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
More information about the Ironpython-users
mailing list