这里是openkava 的blog,关注程序开发的一切技术。 ZZ 表示转载的文章,如涉及版权,请和我联系删除。 在这里你可以看到关于以下技术的文章: 移动开发技术,ANDROID ,IOS,WINDOWS PHONE平台开发,企业ERP开发,动态脚本PYTHON ,OPENGL ES 3D技术,游戏开发技术,HTML5 ,JAVASCRIPT ,MYSQL,AMAZON EC2 ,GOOGLE GAE ,GOOGLE CLOUD SQL 等 。 本站发展历程: 2010年,正式把所有的blog移到这里,租用godaddy的空间,记录生活和工作上的一些心得。 下面是关于我的个人介绍,写在这里权当凑字数啦。 职业:软件开发,开发经验6年,管理经验3年; 工作上使用的技术:C#, SQL SERVER 个人使用的技术:PYTHON,PHP, CSS, JAVA ,ANDROID ,object-c 等等 联系我请发邮件:<a href=""><img class="alignnone size-full wp-image-96" title="邮箱" src="" alt="" width="174" height="24" /></a>

JavaScript Cross-Origin Solutions

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.

Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.