我有一个使用用于H5的M3 TypeScript SDK编写的应用程序(M3 Web客户端)。该程序正在Windows的Chrome中的M3 / H5中运行。它用于处理信用卡付款,并在M3 / H5内部的iFrame中访问处理器的站点。它使用dispatchEvent将消息传递回M3 / H5。托管域和服务域相同。
使用TypeScript动态构建表单,iFrame和对话框,并在生成时向其添加适当的CSC标头。添加CSC标头帧祖先解决,我在开发期间遇到的跨域错误的任何问题直接在M3 BE中运行。
但是,当我在IOS (Infor操作系统)中打开M3时,出现错误“通过访问跨组织框架阻止了具有原点[x]的框架。” < / em>,即使添加了标题也是如此。我尝试将https://添加到域名,自我,本地主机和所有相关域中。
发生这种情况时,返回M3 / H5的呼叫当然不会完成。
如果我直接在M3 / H5商业引擎中运行IOS的相同代码外部,则不会发生任何错误。 dispatchEvent有效,并且M3处理事务。
我尝试设置各种IOS网格设置,但无济于事。我还向Infor开了票,但他们仍在努力。
实际的代码非常简单,但为清楚起见,我也会提供它。我已经尝试过使用postMessage以及将targetOrigin参数设置为'*'。
function callParentFunction(str) {
if (str && str.length > 0)
{
//Errors indicate a mismatch in domain between the page containing the iframe and this page.
console.log("callParentFunction:" + str);
var event2M3 = new CustomEvent("adn2m3", { detail: str });
event2M3.bubbles = true;
event2M3.initCustomEvent("adn2m3", true, false, { detail: str });
top.ccPaymentDiag.dispatchEvent(event2M3);
}
}
function receiveMessage(event) {
//console.log("receiveMessage");
if (event && event.data) {
console.log("call Event Origin: " + event.origin);
callParentFunction(event.data);
}
}
if (window.addEventListener) {
window.addEventListener("message", receiveMessage, false);
} else if (window.attachEvent) {
window.attachEvent("onmessage", receiveMessage);
}
if (window.location.hash && window.location.hash.length > 1) {
callParentFunction(window.location.hash.substring(1));
}
目前,我不确定如何继续。任何建议都将不胜感激。
谢谢;
比利