开发者

Permission denied for ajax request inside an iFrame

开发者 https://www.devze.com 2023-01-19 05:20 出处:网络
For many various reasons my web page consist of the following, a ruby page from www.example.com that calls an iFrame from another PHP server (subdomain.example.com), in both parent and child there is

For many various reasons my web page consist of the following, a ruby page from www.example.com that calls an iFrame from another PHP server (subdomain.example.com), in both parent and child there is this javascript instruction : document.domain="example.com";

Parent page can access elements in child page, 开发者_开发问答I needed that to make the parent page change height as it's child and it works nicely.

But the problem is in ajax request when I do the following code :

$.ajaxFileUpload

(

{

        url:'www.example.com',

        secureuri:false,

        fileElementId:'image',

        dataType: 'json',

        success: function (data, status)

        {
    //Code 1

        },

        error: function (data, status, e)

        {
    //Code 2

    alert(e);

        }

}

)

For some reason it execute Code 2 and prompts this error:

Error: Permission denied for http://www.example.com (document.domain=http://example.com) to get property Window.document from http://www.example.com (document.domain has not been set).

Even though the request is correctly received on the browser with the right values (Checked through Firebug Net feature)... and the image is actually uploaded on subdomain.example.com server.

Thanks, Wa'el


www.example.com and example.com are two distinct hostnames. Maybe the issue is that an XSS filter is triggered.

0

精彩评论

暂无评论...
验证码 换一张
取 消