Forum: Rails Spinoffs (closed, excessive spam) permission denied when using prototype

Posted by odelya (Guest)
on 2008-07-01 13:14
(Received via mailing list)
Hi,

i am trying to call AJAX with domain address different than mine.
but i get an exception:
permission denied to call method XMLHTTPRequest.open

What's the solution?
Posted by Frederick Polgardy (Guest)
on 2008-07-01 14:48
(Received via mailing list)
You can't.  XMLHttpRequest cannot go across domains.  There is a W3C
recommendation on the table to provide this capability (server-side 
config
will be necessary).

http://www.w3.org/TR/access-control/

You can also use JavaScript/JSON with dynamic script tags to accomplish
cross-site requests, but it's a more limited scenario.  You can find 
some
resources by googling for ajax dynamic script tag.

-Fred

On Tue, Jul 1, 2008 at 6:13 AM, odelya <be.special@gmail.com> wrote:

>
> Hi,
>
> i am trying to call AJAX with domain address different than mine.
> but i get an exception:
> permission denied to call method XMLHTTPRequest.open
>
> What's the solution?


--
Science answers questions; philosophy questions answers.
Posted by Rudy Susanto (Guest)
on 2008-07-01 14:48
(Received via mailing list)
You could not request ajax to different domain. This rule named SOP
(Same Origin Policy), and it was mentioned in manual like this:
"/remember that XHR is usually used on URLs from the same host that
originated the current page (this is the famous Same Origin Policy, or
SOP)/".

There are some solutions. You could request to file at your own domain,
and this file will request to content at target domain. Or, with JSONP.
This topic is locked and can not be replied to.