I want to implement a simple functionality in JavaScript, which is to call data from other websites, such as HTML, XML, or JSON. However, this damn cross-domain restriction doesn't allow it, and the behavior of Firefox, Safari, and Chrome is also different.
I searched online and found a method called JSONP.
However, the website needs to return something like JavaScript, including the data returned, wrapped in JavaScript, and then execute the returned JavaScript to obtain the data.
Example: func("<myxml></myxml>") or
var someVar = "<myxml></myxml>";
This method requires that the website being accessed can be directly controlled, which is obviously not possible.
It's still more enjoyable to turn to native development.
Reference: JavaScript, JSONP and reading XML from cross-domain - Stack Overflow.