Advertisement
728x90
The second argument of postMessage method specifies which origin is allowed to receive the message. If you use the wildcard “\*” as an argument then any origin is allowed to receive the message. In this case, there is no way for the sender window to know if the target window is at the target origin when sending the message. If the target window has been navigated to another origin, the other origin would receive the data. Hence, this may lead to XSS vulnerabilities.
javascript
1targetWindow.postMessage(message, "*");Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 70
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
327of476