I would like to test if a JavaScript object is a Proxy. The trivial approach
if (obj instanceof Proxy) ...
doesn\'t work here, nor does tra
Use window.postMessage() with try-catch
postMessage cannot serialize objects which incompatible with structured clone algorithm, like Proxy.
function isProxy(obj) { try { postMessage(obj, "*"); } catch (error) { return error && error.code === 25; // DATA_CLONE_ERR } return false; }