[IronPython] Silverlight and Catching HttpWebRequest Errors

Jimmy Schementi Jimmy.Schementi at microsoft.com
Mon May 12 22:05:15 CEST 2008


> >> 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



More information about the Ironpython-users mailing list