Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 像X3DOM中的纹理一样加载http url图像_Html_Http_X3dom - Fatal编程技术网

Html 像X3DOM中的纹理一样加载http url图像

Html 像X3DOM中的纹理一样加载http url图像,html,http,x3dom,Html,Http,X3dom,我正在学习X3DOM,我想知道为什么当我在浏览器中使用本地html代码时,没有加载纹理(URL http链接,没有本地图像)。圆筒看起来是黑色的 <html> <head> <script src="http://www.x3dom.org/download/dev/x3dom.js"></script> <link rel="stylesheet" href="http://www.x3dom.org/download/d

我正在学习X3DOM,我想知道为什么当我在浏览器中使用本地html代码时,没有加载纹理(URL http链接,没有本地图像)。圆筒看起来是黑色的

<html>
<head>
    <script src="http://www.x3dom.org/download/dev/x3dom.js"></script> 
    <link rel="stylesheet" href="http://www.x3dom.org/download/dev/x3dom.css">
    <title>DOM Field Interface Test</title>
</head>
<body>
    <div id="testbedDiv">    
        <h2>X3DOM Scene:</h2>
        <x3d width='500px' height='400px'> 
            <scene>
                <shape> 
                    <appearance> 
                    <ImageTexture  url="http://drive.google.com/uc?export=view&id=0B0GIfItPpsqjMEUyLU9Fam9aQ0E"><ImageTexture/>
                </appearance> 
                    <Cylinder ></Cylinder>
                </shape> 
            </scene>
        </x3d>
    </div>
</body>
</html>

DOM字段接口测试
X3DOM场景:

或者,如果有人知道,也可以使用.x3d http url链接的“inline”标记(也没有本地链接)

X3DOM在JavaScript沙盒中运行。这意味着,如果不在服务器上放置特殊代码,您将无法访问服务器以外的文件。对于本地文件,没有服务器。您仅限于本地文件


根据我在PC上的经验,您可以在Firefox和IEV11中使用本地文件,但不能在Chrome中使用。

因为x3dom在内部与XHR一起工作,这带来了一些限制,如CORS。我不知道本地页面的实际表现如何,但至少对于托管页面,在加载外部资源时,这是一个主要的障碍。我不理解唯一的改变方法是改变X3DOM.jar以避免CORS,或者改变服务器以避免CORS?非常感谢,为了处理CORS,您必须更改服务器设置。这是因为Javascript(不是Java)是在web浏览器中运行的。底层机制是相同的,不能通过简单地调整x3dom来改变。非常感谢。