Home  >  Article  >  Web Front-end  >  Summary of JavaScript cross-domain solutions (code)

Summary of JavaScript cross-domain solutions (code)

不言
不言forward
2019-03-26 09:33:402202browse

This article brings you a summary (code) of cross-domain solutions. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you. .

Same origin policy: the protocol, domain name, and port are all the same.

Non-original restriction:

Cookie, localStorage, and indexDB cannot be read.

DOM cannot be obtained.

The AJAX request cannot be sent.

Solution:

1. JSONP

Principle: Request JSON data from the server by dynamically adding a