Javascript restrictions on accessing remote servlet
I have the following setup:
Host C
is the client that runs a browser.
Host S1
is a server that hosts our html files.
Host S2
is a server that hosts our Java servlets.
I would like my javascript code to be loaded from either an HTML file on C
or on S1
and then submit a form to (plus get response from) server S2
.
NOTE: on loading from C
, the HTML file is to be opened directly without needing a web server.
It seems that Javascript restrictions do not allow this to happen, but I am not able 开发者_如何学运维to find proper documentation of these restrictions anywhere. Keeping in mind that I am very new to javascript (my 1st day today), please point me to the right answer/resources.
Right now the computers are named as follows:
S1 = server1.subdomain1.mydomain.com
S2 = server2.subdomain2.mydomain.com
C = client.subdomain3.mydomain.com
It's perhaps due to the "Cross domain restriction" : see example at http://en.wikipedia.org/wiki/Same_origin_policy (in the table)
http://www.example.com/dir/maint.html
http://v2.www.example.com/dir/other.html Failure Different host (exact match required)
Right ?
AKA.
Read this page : http://en.wikipedia.org/wiki/Same_origin_policy. This policy "prevents access to most methods and properties across pages on different sites".
There are workarounds for bypassing this same origin policy, by using JSONP or iframes.
精彩评论