Mikhail Batcer
Mikhail Batcer

Reputation: 2065

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

Upvotes: 5

Views: 2909

Answers (1)

Mikhail Batcer
Mikhail Batcer

Reputation: 2065

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

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

Upvotes: 3

Related Questions