繁体   English   中英

Ajax表单-图片上传| 拒绝访问,即

[英]Ajax form - image upload | access denied in ie

我正在创建一个Facebook应用程序,并想使用jquery form plugin实现一个类似ajax的图片上传。 在chrome / ff中一切正常,但是在iexplorer中,我得到以下错误:

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

我知道跨域问题,但无法理解为什么会这样,因为我当前使用的所有脚本都在同一个域中。
这是我在Firefox / Chrome中完成工作的方式:

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

任何想法为什么会这样?
提前致谢。

好,距离我发布问题已经有一段时间了,但这终于对我有用:

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

如果您正在从安全页面(https)到非安全页面或副版本进行ajax调用,则IE将显示错误。

确保所有URL,页面URL和Ajax URL都具有相同的安全性。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM