如题,我的hbuilder页面里面嵌入了一个网页 但是,无法通过网页调用父页面的对象
hbuilder页面变量:
window.top.Context=
{
toast:function(x){
alert(x);
},
ddd:"4444"
};
iframe网页:调用 window.top.Context.toast("请输入内容!");
报错:
Uncaught SecurityError: Blocked a frame with origin "http://192.168.0.114:5555" from accessing a frame with origin "file://". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "file". Protocols must match.
百度了下好像是跨域问题但是没找到解决方案。求解!
1 个回复
chender - 与人为善
这个就是常规的跨域问题,和hbuilder没关系哈,网上查一下iframe跨域,解决方案一大堆