Valums文件上传器给出一个“;访问控制允许原点不允许原点为null";错误

本文关键字:原点 许原点 不允许 quot 错误 null 访问控制 文件 一个 Valums | 更新日期: 2023-09-27 18:19:39

我想使用Valums文件上传javascript。然而,当我运行演示或他们提供的测试时,我会在Chrome中得到一个Origin null is not allowed by Access-Control-Allow-Origin.。它在firefox上也不起作用,但它似乎在InternetExplorer上起作用。

代码太长了,无法发布,我不知道哪里出了问题,如果你需要代码的一部分,我可以添加它。

html:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="fileuploader.css" rel="stylesheet" type="text/css"> 
<style>     
    body {font-size:13px; font-family:arial, sans-serif; width:700px; margin:100px auto;}
</style>    
</head>
<body>      
<p><a href="http://github.com/valums/file-uploader">Back to project page</a></p>
<p>To upload a file, click on the button below. Drag-and-drop is supported in FF, Chrome.</p>
<p>Progress-bar is supported in FF3.6+, Chrome6+, Safari4+</p>
<div id="file-uploader-demo1">      
    <noscript>          
        <p>Please enable JavaScript to use file uploader.</p>
        <!-- or put a simple form for upload here -->
    </noscript>         
</div>
<script src="fileuploader.js" type="text/javascript"></script>
<script>        
    function createUploader(){            
        var uploader = new qq.FileUploader({
            element: document.getElementById('file-uploader-demo1'),
            action: 'do-nothing.htm',
            debug: true
        });           
    }
    // in your app create uploader as soon as the DOM is ready
    // don't wait for the window to load  
    window.onload = createUploader;     
</script>    
</body>
</html>

Valums文件上传器给出一个“;访问控制允许原点不允许原点为null";错误

您的代码可能没有什么问题,但您试图违反同源策略。基本上,如果您的站点是http://aaa.com/,则不能将AJAX调用到http://bbb.com/