TypeError:IOS上带有window.postMessage的参数不足

ash
window.postMessage(JSON.stringify({
    type: 'loggedIn',
    userToken: token,
}));

我的问题是从上面的代码。它使我TypeError: Not enough arguments在ios设备上。如果您遇到此问题,请帮助我。

谢谢

TJ人群

您没有同时提供两个必需的参数。MDN文档中

 targetWindow.postMessage(message, targetOrigin, [transfer]);

请注意,这targetOrigin不是可选的。指定消息的目标来源,例如:

window.postMessage(JSON.stringify({
    type: 'loggedIn',
    userToken: token,
}), window.origin);

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章