opengl insights:4 webgl for opengl developers

1。跨域

代理服務器

img.src = "proxy.phy?anotherDomain.com/img.png


CORS

cross-origin resource sharing.see http://enable-cors.org/

In PHP

If you don't have access to configure Apache, you can still send the header from a PHP script. It's a case of adding the following to your PHP scripts:

 <?php
 header("Access-Control-Allow-Origin: *");

For Apache

Apache can be configured to expose this header using mod_headers, this is enabled by default in Apache however you may want to ensure it's enabled by running the following command:

a2enmod headers

To expose the header you simply add the following line inside <Directory><Location><Files> or <VirtualHost>sections, or within a .htaccess file:

Header set Access-Control-Allow-Origin *

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章