-2

How do I have a function that opens a new tab in the browser with custom html that is generated in the root tab?

McMatt
  • 129
  • 1
  • 14

1 Answers1

2

You can do this

var x=window.open();
x.document.open().write('<h1>Test</h1>');
x.close();

Note that you cannot force it to be a new tab as that is a user preference (of new window / new tab)

Turv
  • 101
  • 3