【发布时间】:2015-05-21 21:18:10
【问题描述】:
我一直在尝试使用以下技术将一些 xml 内容传递到新的浏览器窗口:
var newWindow = window.open('', '_blank');
newWindow.document.clear();
newWindow.document.open();
newWindow.document.write(xmlString);
newWindow.document.close();
但是,xml 被放置在新窗口中的 <body></body> 标记内。
如何让我的 xml 文档代表窗口的全部内容(无 <html></html> 标记)?
【问题讨论】:
-
@SterlingArcher Perfect: jsfiddle.net/1sh9tyq9(别忘了允许弹出窗口)
-
@SterlingArcher - 谢谢,我已经看到了这个问题,但是,只有在我弄清楚如何使
<html></html>标记消失之后,它才变得相关。一旦我得到这个问题的答案,这是第 2 步。 ;) -
@blex - 完美!将其发布为答案,我会接受。
-
那是你的公爵夫人,blex。
标签: javascript html xml