Ajax表单-图像上传|访问在ie中被拒绝

Ajax form - image upload | access denied in ie

本文关键字:ie 拒绝 访问 表单 图像 Ajax      更新时间:2023-09-26

我正在创建一个facebook应用程序,并希望使用jquery表单插件实现类似ajax的图片上传。chrome/ff中的一切都很好,但在IE浏览器中,我得到了以下错误:

Message: Access Denied   
Line: 349  
Char: 5  
Code: 0  
URI: http://application.my_domain.gr/apps/new_app/js/jquery.form.js 

我知道跨域的问题,但不明白为什么会发生这种情况,因为我经常使用的所有脚本都在同一个域上
以下是我在firefox/cochrome:中的工作方式

<html>
<head>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/jquery.form.js"></script>
</head>
<body>
<form id="imageform" method="post" enctype="multipart/form-data" action='ajaximage.php'>
        <input type="file" name="photoimg" id="photoimg" />
</form>
<div id='preview'>
</div>
<script>
$('#photoimg').bind('change', function() { 
                    $("#preview").html('');
                    $("#preview").html('<img src="img/loader.gif" alt="Upload in progress"/>');
                    $("#imageform").ajaxForm({
                                        target: '#preview',
                                        success:    function() { 
                                                $("#preview img").attr("id", "uploaded_img");
                                        }
                    }).submit();
                                        
            
            });
</script>
</body>
</html>

你知道为什么会这样吗
提前谢谢。

好吧,我发布这个问题已经有一段时间了,但最终对我有效的是:

我刚刚在应用程序的基本设置(基本信息部分)中将我的域添加到"应用程序域"中,一切正常!

IE将显示错误,如果您从安全页面(https)执行ajax调用到非安全页面,反之亦然。

确保所有url、页面url和ajax url都具有相同的安全性。