Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用easyXDM修改提供程序页面的内容_Javascript_Cross Domain_Rpc - Fatal编程技术网

Javascript 使用easyXDM修改提供程序页面的内容

Javascript 使用easyXDM修改提供程序页面的内容,javascript,cross-domain,rpc,Javascript,Cross Domain,Rpc,我正在尝试使用javascript库来实现一些跨域攻击 easyXDM的一些背景知识。我们有两个角色: 提供程序,它提供供其他人调用的函数 使用者,它调用提供者提供的函数 要求如下: The consumer passes the content as parameter and calls the function through RPC. The provider receives the request and use the content to modify its page. 在

我正在尝试使用javascript库来实现一些跨域攻击

easyXDM的一些背景知识。我们有两个角色:

  • 提供程序,它提供供其他人调用的函数
  • 使用者,它调用提供者提供的函数
  • 要求如下:

    The consumer passes the content as parameter and calls the function through RPC. 
    The provider receives the request and use the content to modify its page.
    
    在这里,修改其页面意味着尝试修改DOM结构或DOM节点中的内容

    提供者端的代码,一旦消费者请求,提供者将修改其页面内容

    var provider = new easyXDM.Rpc({}, {
        local: {
            modifyContent: {
                method: function(content){
                    // modify the content on my page
                }
            }
        }
    });
    
    使用者端,将执行RPC请求提供者更改其页面

        var consumer = new easyXDM.Rpc({
            remote: "remoteUrl"
        }, {
            remote: {
                modifyContent: {}
            }
        });
        //perform RPC and ask the provider to the modify its content
        consumer.modifyContent("This is some content that should be used to modify your content");
    
    除了提供者试图使用内容修改其页面外,一切都进行得很顺利

        var consumer = new easyXDM.Rpc({
            remote: "remoteUrl"
        }, {
            remote: {
                modifyContent: {}
            }
        });
        //perform RPC and ask the provider to the modify its content
        consumer.modifyContent("This is some content that should be used to modify your content");
    
    不会出现错误或警告。但是页面不会像预期的那样改变

    此外,我单独运行“更改内容”代码(如在Firebug控制台或Chrome控制台中复制和粘贴并运行),它可以工作

    以前是否有人使用过easyXDM并遇到过此问题


    PS:
    easyXDM
    似乎不是这里的标签。如果您同意,请为我添加它。

    我遇到了相同的问题,问题是我不了解easyXDM的RPC功能是如何工作的

    我的问题是,我将子iframe添加到父级,然后使用添加到页面的iframe的url调用easyXDM.Rpc()。当我从父对象向子对象发送消息时,子对象会很好地接收消息(并且控制台会记录正确的消息),但我无法更改子iframe中的任何本地内容或全局变量。我不明白的是,当在父级中创建新的RPC客户端时,该工具会自动创建一个iframe。我以为它会使用我在页面上绘制的iframe。因此,我从一个iframe(默认情况下是在屏幕外绘制的)进行日志记录,并与一个没有连接到RPC调用的iframe进行交互


    为了解决这个问题,我删除了添加到页面中的iframe,并使用RPC config的“props”属性使iframe在屏幕上可见。一旦我这样做了,一切都很顺利。

    我遇到了同样的问题,问题是我不理解easyXDM的RPC功能是如何工作的

    我的问题是,我将子iframe添加到父级,然后使用添加到页面的iframe的url调用easyXDM.Rpc()。当我从父对象向子对象发送消息时,子对象会很好地接收消息(并且控制台会记录正确的消息),但我无法更改子iframe中的任何本地内容或全局变量。我不明白的是,当在父级中创建新的RPC客户端时,该工具会自动创建一个iframe。我以为它会使用我在页面上绘制的iframe。因此,我从一个iframe(默认情况下是在屏幕外绘制的)进行日志记录,并与一个没有连接到RPC调用的iframe进行交互


    为了解决这个问题,我删除了添加到页面中的iframe,并使用RPC config的“props”属性使iframe在屏幕上可见。一旦我这样做了,一切都很顺利。

    我也遇到了类似的情况,我使用jQ append添加iframe,而不是使用easyXDM的remote参数。一旦我修好了,我就准备好了!我也遇到了类似的情况,我使用jQ append添加iframe,而不是使用easyXDM的remote参数来完成。一旦我修好了,我就准备好了!