问题描述
我正在使用后消息来控制youtube视频,例如在我的网站上暂停,播放和停止。但是到目前为止,我已经将 targetOrigin 用作“ *”。为了确保targetOrigin的安全,我想知道是否需要将其替换为“ https://www.youtube.com” 或“ example.com” 吗?>
如果example.com是我的网站名称
contentWindow.postMessage('{“ event”:“ command”,“ func”:“'+'pauseVideo'+'”,“ args”:“”}','*');
替换为
contentWindow.postMessage('{“ event”:“ command”,“ func”:“'+'pauseVideo'+'”,“ args”:“”}','https://www.youtube.com ');
或
contentWindow.postMessage('{“ event”:“ command”,“ func”:“'+'pauseVideo'+'”,“ args”:“”}','example.com');
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)