What is cross-domain, what is homologous

Cross-domain

  1. is a cross-domain, cross-port, cross-protocol

     For example: if you have two servers, Server A and Server B, stored on a server A php data, script, even those css files, and you only write html on the server B, then B dynamically created on the server where you are after the script, css, php data (using ajax request), you want to request script on the server a, css, php number of requests (using ajax) According to these documents, requests for these files, you run on your server B html, though your address is on the server B, but you can still run effect as running on the server a is the same, so that cross-domain, cross-port, cross-protocol implements inter-domain.

  Simply put, you are requested file, as long as containing the "src", "href" These attributes, you can access it on another server, the request file you need, and then run on their own servers, to achieve cross-domain (cross-domain, cross-port, cross-protocol).

Dynamic native script file request 

  var _script = document.createElement("script");
  _script.src="http://10.9.156.108/html5/Ajax/api/sendMessage.php?user="+_user+"message="+_message;
  _script.type="text/javascript";

cross-domain requests jQuery script file

$ (Document) .ready (function () {
  // back getJSON parameters, default parameters are not without cross-domain, with a cross-domain parameters

  //跨域优先
  $.<link rel="icon" href="../img/favicon.ico" type="image/x-icon">("http://10.9.156.108/HTML5/lesson24/test.js?callback=?",[data],function(){});

  // getJSON and have cross-domain jsonp two ways
  $ .get ( "http://10.9.156.108/HTML5/lesson24/test.js=", null, function () {}, "jsonp");
   
});

 

Homologous

  Is the same domain name, with the port, with the agreement

  For example: If you have a server A, you need a script, css, php file server A, you also write html on the server A, then run, there has been the effect, if you want in on another computer run your item (note that another computer with or without turn on the server, the effect will still show up), copy down as long as you write on the server a protocol, domain name, port, and name of your project in another running on the computer, it will also appear the same effect, which achieved a homologous.

  Simply put, your protocol, domain name, port and even the project name are the same, different computers can achieve the same effect.

 

Whether it is the same computer or a different computer, can achieve cross-domain and homology.

 

What what is the protocol, domain name, port?

Explanation: If a URL is http://baidu.com:8080?user=name&pwd=password

http: // protocol is   

baidu.com domain name (note: preceded by "wwww" that is not a domain name www.baidu.com)

8080 is the port    

user = name & pwd = password parameter is the address of the tape

Guess you like

Origin www.cnblogs.com/SallyShan/p/11530644.html