tags:

views:

170

answers:

1

I'm a bit confused about this.

Does XMLHttpRequest work on a remote URL or does it have to be a local file? There seems to be mixed information on the net.

According to w3.org: The XMLHttpRequest object can be used by scripts to programmatically connect to their originating server via HTTP.

But I've seen it used to access non-local web pages (in vista gadgets for instance for rss feeds) without using a proxy...

Enlighten me please!

+2  A: 

It depends on the environment. If you run your JavaScript on a regular web page, XMLHttpRequest won't be able to connect to any other site. (That's what w3.org says, and browsers do implement this restriction.) However, in some contexts (such as Vista gadgets and Greasemonkey), it it possible to connect to any site in an AJAX request.

pts
Nakes sense. Doesn't that bypass the security precautions though? Wouldn't gadgets be capable of xss?
kylex
Yes, they are capable of xss. If you don't trust them, don't install them.
pts