xs-search library:
for more check xsleaks' git :)
// utils.js
function receiveMessage() {
return new Promise(r => {
window.onmessage = r;
});
}
async function tick() {
window.postMessage(0,'*');
return await receiveMessage();
}
async function isCrossOrigin(ref) {
await tick(); // skip task (responsive)
try {
ref.URL; // access cross-origin property
return false;
} catch(e) {
return true;
}
}