4 ms·
Here's the code to keep your iframe from being abused: window.onmessage = function(e) { if ( /^https?:\/\/((subdomain)\.)?mysite.com/.test(e.
by seph-reed 6y ago
Here's the code to keep your iframe from being abused:
window.onmessage = function(e) {
if (
/^https?:\/\/((subdomain)\.)?mysite.com/.test(e.origin) === false
) {
console.error("Access: No auth");
return;
}
}
If you could specify what the benefit over this approach is, I'd appreciate knowing.