我正在尝试将一些内容添加到在新选项卡/窗口中打开的页面中,但似乎没有发生任何事情。这是我的一些代码:
var newWindow = window.open('/Window');
newWindow.document.body.innerHTML += '<div>This is a test</div>';
有什么想法吗?
最佳答案
因为您已标记 jquery:
var w = window.open();
var html = '<div>This is a test</div>';
$(w.document.body).html(html);
<强> Demo
关于javascript - 在新窗口/选项卡中打开链接后如何将内容添加到页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23202382/