I am having a bit of a battle with something that seems simple. I have a [javascript] string that has DOM elements in it and would like to open a new window (window.open()?) and
Archer's answer is a good one, but you can do this in a one liner if you wish:
window.open("data:text/html;charset=utf-8,"+html, "", "_blank")
window.open("data:text/xml;charset=utf-8,"+xml, "", "_blank")
With XML, make sure you string begins with and has a root element. If it doesn't, you can easily add it:
window.open('data:text/xml;charset=utf-8,'+xml+' ', "", "_blank")