Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #14701

Re: Unclear Error Code

From Stefan Weiss <krewecherl@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Unclear Error Code
Date 2012-06-27 02:29 +0200
Organization albasani.net
Message-ID <jsdk59$44t$1@news.albasani.net> (permalink)
References (2 earlier) <p4diu75iefnrcbm62bm46oglu9mf7ql7og@4ax.com> <dtoGr.405303$jl.276261@fx19.am4> <326ku7dmhf5i0hosp63996crif8apmlm9f@4ax.com> <jsd7hr$tqm$1@news.albasani.net> <d5iku71950s43qlb6hvcosc3s5c9qkiedb@4ax.com>

Show all headers | View raw


On 2012-06-27 01:42, Gene Wirchenko wrote:
> On Tue, 26 Jun 2012 22:54:18 +0200, Stefan Weiss
> <krewecherl@gmail.com> wrote:
>> Looks like Mike is right, and you're running into a SOP-problem. If
>                                                      ^^^
>      Please expand this.

Same Origin Policy (see below).

>> you're not loading the page from www.ucantrade.com, you can't send an
>> XHR to that server:
>> https://en.wikipedia.org/wiki/Same_origin_policy

That article gives a usable (I think) overview of the general problem.
It may be a little outdated, and missing references, as PE pointed out,
but gives a decent introduction. For more details, check out the other
references in PE's reply.

>      In IE 9, I have no problem at all.  In Firefox 13.0.1, it blows
> up every time.

It "blows up" in every browser I've installed here. IE9 is not available
on my platform, but I doubt this policy would have changed dramatically
since IE8. The (embarrassingly out of date and insecure) version of IE8
that I've got running in a VM gives the expected error: "Request failed.
TypeError Access denied".

It's possible to tell IE to trust certain hosts, so that the SOP
restrictions may be relaxed in your case. Try uploading the same page to
an untrusted webserver and try again. Or try this one:
   http://foo.at/tmp/2012/soptest.html

I have little experience with IE, but I guess it may be possible to
deactivate some security features completely. If you did that, you may
want to reset them to their defaults (for your own safety).

Anyway, it "shouldn't work". If you want to access data from a different
host, you'll need to use one of the workarounds mentioned in the linked
pages (like JSONP). If all else fails, you can have your webserver fetch
the remote data and proxy it for your client.

- stefan

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Unclear Error Code Gene Wirchenko <genew@ocis.net> - 2012-06-25 17:46 -0700
  Re: Unclear Error Code Jeff North <jnorthau@yahoo.com.au> - 2012-06-26 11:32 +1000
    Re: Unclear Error Code Gene Wirchenko <genew@ocis.net> - 2012-06-25 21:03 -0700
      Re: Unclear Error Code Mike Winter <usenet@michael-winter.me.invalid> - 2012-06-26 20:55 +0100
        Re: Unclear Error Code Gene Wirchenko <genew@ocis.net> - 2012-06-26 13:30 -0700
          Re: Unclear Error Code Stefan Weiss <krewecherl@gmail.com> - 2012-06-26 22:54 +0200
            Re: Unclear Error Code Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-06-26 23:20 +0200
            Re: Unclear Error Code Gene Wirchenko <genew@ocis.net> - 2012-06-26 16:42 -0700
              Re: Unclear Error Code Stefan Weiss <krewecherl@gmail.com> - 2012-06-27 02:29 +0200
          Re: Unclear Error Code Bjoern Hoehrmann <bjoern@hoehrmann.de> - 2012-06-26 23:18 +0200
          Re: Unclear Error Code Mike Winter <usenet@michael-winter.me.invalid> - 2012-06-26 22:34 +0100

csiph-web