Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is an AJAX call cross-domain if only the port is different?

The main page is www.myserver.com:80 and the ajax references www.myserver.com:8081.

The status code is 0 and the text is null. Is this a cross domain denial?

like image 986
dacracot Avatar asked Jun 21 '10 18:06

dacracot


People also ask

Are different ports considered cross-domain?

Websites that have the combination of the same scheme, hostname, and port are considered "same-origin". Everything else is considered "cross-origin".

What is cross-domain in AJAX?

CORS is a mechanism that defines a procedure in which the browser and the web server interact to determine whether to allow a web page to access a resource from different origin. Figure 2. Cross domain ajax request. When you do a cross-origin request, the browser sends Origin header with the current domain value.

Does AJAX support cross-domain?

For a successful cross-domain communication, we need to use dataType “jsonp” in jquery ajax call. JSONP or “JSON with padding” is a complement to the base JSON data format which provides a method to request data from a server in a different domain, something prohibited by typical web browsers.

Why is cross-domain not allowed in AJAX?

Because of Same origin policy. The same-origin policy exists to prevent malicious use of resources. If there were no rules governing cross-domain script access, it would be trivial to wreak all manner of havoc on unsuspecting users.


1 Answers

Yes, this violates the same origin policy.

like image 70
dacracot Avatar answered Oct 29 '22 18:10

dacracot