官网http范例跨域问题解决方法

CCC中

服务器(这里以servlet作为示例)

可以了 运行效果如图

特别鸣谢:

=。=现在还在远程填坑中

4赞

发布MAC 没有问题。发布 IOS 网页 却有跨越问题。官方不能解决吗?

0.0按道理网页的跨域问题和操作系统是无关的。毕竟是浏览器的技术
可以进官方二群问老司机: 428196107
这里图片要挂外链。

发布MAC 没有问题。发布 IOS 网页 却有跨越问题。官方不能解决吗?

WebGL 环境对于跨域图片是禁止的,可能跟这个有关系

有什么解决办法么 我用的Lite也出现这个问题 服务器那边已经设置允许了 但是下载下来后无法渲染
Uncaught SecurityError: Failed to execute ‘texImage2D’ on ‘WebGLRenderingContext’: The cross-origin image at http://special.dajie.com/nb/assets/vsite/JINGDONGtest/ui/loadimg/loaderstuff.8584.png may not be loaded.

WebGL 上是严格禁止跨域的,可以尝试用自己的服务器转发文件

OK 多谢解答~

这应该是因为我们 downloadImage 中的 isCrossOrigin 没设为 true 吧

有设置,但是 WebGL 对跨域图片有更严格的限制

标准中是这么说的:

4.2 Origin Restrictions

In order to prevent information leakage, WebGL disallows uploading as textures:

  • Image or video elements whose origin is not the same as the origin of the Document that contains the WebGLRenderingContext’s canvas element
  • Canvas elements whose bitmap’s origin-clean flag is set to false
  • ImageBitmap objects whose bitmap’s origin-clean flag is set to false

If the texImage2D or texSubImage2D method is called with otherwise correct arguments and an HTMLImageElement, HTMLVideoElement, HTMLCanvasElement, or ImageBitmap violating these restrictions, a SECURITY_ERR exception must be thrown.

但是紧接着也提到非规范的处理方式也包含对于服务器显式声明可以被 WebGL 安全访问的图片,也是可以使用的,不过要完全符合 CORS 的访问规范,这方面我就不是特别确定具体该怎么做了

此外,仔细看一下 @kyo7611621 的错误中提到的是图片可能未被加载,也许是加载出问题了

标准后面有提到,设置 image.crossOrigin = “anonymous”; 就可以了。所以应该还是别的地方有问题。

http://jsfiddle.net/greggman/MZpx8/
翻墙试下,这个范例是 OK 的。

markedIT

看到了另外一种跨域的解决方法 web sockets,感觉这种方法比较好,适合用node.js做服务器 http://blog.csdn.net/joyhen/article/details/21631833

大兄弟,这个问题你是怎么解决的呀,我也遇到了,看了你的帖子,没有解决掉

大大,也遇到了这个问题,


论坛里找了不知道怎么解决这个问题了。。。

我也遇到这个问题了,不知道怎么解决,求大神回复,谢谢。

你解决这个问题了吗

你解决了吗 请问是如何解决的?

你是如何解决的呢

如何设置downloadImage这个参数呢