Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Make a public pad on . Open your developer console and paste the code into the Javascript evaluator. (You might need to enable popups.) A window will show where Javascript (that is in your pad) will be executed when you add/remove lines in your pad. Let someone else do the same on your pad, so you can collaborativel…
(function() {
var targetWindow =,null,'resizable=yes,scrollbars=yes,status=yes');
/*var iframe = document.createElement('iframe'); = 'absolute'; = 1000; = 0;
iframe.width = '300px';
iframe.height = '300px'; = 'white';
var targetWindow = iframe.contentWindow;*/
var previousLineCount = 0;
setInterval(function() {
var lines = document.getElementById('editorcontainer').getElementsByTagName('iframe')[0].contentWindow.document.getElementById('outerdocbody').getElementsByTagName('iframe')[0].contentWindow.document.getElementById('innerdocbody').getElementsByTagName('div');
if (previousLineCount === lines.length) { return; }
var content =,function(line) {
return line.textContent;
targetWindow.document.write('<!DOCTYPE html>\n<html><head><script language="javascript">\n'+ content + '\n</script>\n</head>\n<body>\n</body>\n</html>');
previousLineCount = lines.length;
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.