admin管理员组

文章数量:1529452

由于之前设计不完善,之前在做给项目增加一个gephi图功能的时候,构建图的json文件都放置在了项目中,随着数据更新,体积逐步增大,为服务器更新项目造成不必要的麻烦,今天抽出时间把问题来解决了一下。

在项目的ftp文件目录新建了一个位置存放json文件,利用nginx代理服务器取文件位置。

将代码改好之后调试发现问题,chrome控制台提示

Font from origin 'http://192.168.1.98:12346/files/data.json' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9033' is therefore not allowed access.

网上有许多解决跨域的方法,大体上有这几种:

1)document.domain+iframe的设置

2)动态创建script

3)利用iframe和location.hash

4)window.name实现的跨域数据传

本文标签: 浏览器提示站点资源control