Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/435.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 重新加载页面以添加内容_Javascript_Html - Fatal编程技术网

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在这种情况下,它必须是同一页面。