Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
const script = `
onmessage = (evt) => {
  const url = URL.createObjectURL(new Blob([String(evt.data)], {type: 'text/html'}));
  window.parent.postMessage([evt.data, url], '*');
}
`;
const scriptURL = URL.createObjectURL(new Blob([script], {type:'text/javascript'}));
const iframe = Object.assign(document.createElement('iframe'), {
  src: URL.createObjectURL(new Blob([`<script src=${scriptURL}></script>`], {type: 'text/html'}))
});
window.onmessage = (evt) => {
  const [id, src] = evt.data;
  iframe.remove();
  const check = Object.assign(document.createElement('iframe'), {src: src})
  check.onload = () => console.log('loadable after iframe GC');
  check.onerror = () => console.log('error after iframe GC');
  document.body.append(check);
}
iframe.onload = () => {
  iframe.contentWindow.postMessage('post-GC', '*');
}
document.body.append(iframe);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
bmeckpro
0viewers