Javascript 重新加载页面以添加内容
在我的页面上,我有以下代码:Javascript 重新加载页面以添加内容,javascript,html,Javascript,Html,在我的页面上,我有以下代码: <script type="text/javascript"> if(!window.opener) { window.open(window.location.href, '_blank'); } </script> 如果(!window.opener){ window.open(window.location.href,“_blank”);
<script type="text/javascript">
if(!window.opener) {
window.open(window.location.href, '_blank');
}
</script>
如果(!window.opener){
window.open(window.location.href,“_blank”);
}
基本上在一个新窗口中打开“自身”,没有一个恒定的循环如何将“附加”Javascript内容添加到打开的新窗口,而不是原始窗口?
<script type="text/javascript">
if(!window.opener) {
window.open(window.location.href, '_blank');
} else {
// ...add additional content here...
}
</script>
如果(!window.opener){
window.open(window.location.href,“_blank”);
}否则{
//…在此处添加其他内容。。。
}
您正在寻找……其他
?这里最简单的解决方案可能是在打开的窗口中使用不同的页面。相同的页面,相同的内容(除非你用cookies做了一些有趣的事情)。不同的页面(可以是带有查询字符串的同一基本URL)获得不同的内容。@Zach在这种情况下,它必须是同一页面。