【发布时间】:2012-02-09 16:51:58
【问题描述】:
我正在尝试使用easyXDM 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");
除了提供者尝试使用内容修改其页面时,一切都顺利进行。
不会引发错误或警告。但是页面不会像预期的那样改变。
此外,我单独运行“更改内容”代码(例如在 Firebug 控制台或 Chrome 控制台中复制&粘贴&运行),它会起作用。
有人用过easyXDM,遇到过这个问题吗?
PS:easyXDM 似乎不是这里的标签。如果您同意,请为我添加它。
【问题讨论】:
标签: javascript cross-domain rpc