Search code examples
javascriptmicrosoft-edgepostmessage

SCRIPT5022 Syntax Error in Microsoft Edge during postMessage


window.parent.postMessage(JSON.stringify(data), window.origin)

gives me Syntax error in Microsoft Edge, working ok in Chrome and elsewhere.

This is all that I see in the console:

This is all that I see in the console


Solution

  • window.origin is undefined in Edge, unlike Chrome & Firefox.

    I changed it to window.location.origin (as in standarts) and the error dissapeared