簡體   English   中英

Valums文件上載器給出“ Access-Control-Allow-Origin不允許使用Origin null。”錯誤

[英]Valums file uploader giving an “Origin null is not allowed by Access-Control-Allow-Origin.” error

我想使用Valums文件上傳javascript 但是,當我運行演示或他們提供的測試時Origin null is not allowed by Access-Control-Allow-Origin.使用Origin null is not allowed by Access-Control-Allow-Origin. 在Chrome中。 它也不能在Firefox上運行,但似乎可以在Internet Explorer上運行。

該代碼太長,無法發布,我不知道它出了什么問題,如果您需要一部分代碼,可以添加它。

的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>

您的代碼可能沒有什么錯,但是您正在嘗試違反相同的原始政策 基本上,如果您的網站是http://aaa.com/ ,則無法將AJAX調用到http://bbb.com/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM