Failed to execute 'postMessage' on 'DOMWindow': The target origin provided does not match the recipient window's origin ('null')

前端 未结 6 1440
长发绾君心
长发绾君心 2020-12-05 09:47

I have a game in heroku, now I\'m trying to make it work in Facebook canvas, but, while it works in Firefox, in Chrome and IE doesn\'t.

IE shows a warning with a but

6条回答
  •  温柔的废话
    2020-12-05 10:27

    Another reason this could be happening is if you are using an iframe that has the sandbox attribute and allow-same-origin isn't set e.g.:

    // page.html
    
    
    
    // iframe.html
    
    

    I haven't found a solution other than:

    • add allow-same-origin to the sandbox (didn't want to do that)
    • use f.postMessage("hello world!", '*');

提交回复
热议问题