<html> <head> </head> <body> <input id="wow"> <button id="b">open</button> <script> b.onclick = function(){ var w = open("") w.document.write(wow.value) w.document.write("<button onclick='window.close()'>close</button>") } </script> </body> </html>