Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.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 Can';t检索window.location.href_Javascript_Location Href - Fatal编程技术网

Javascript Can';t检索window.location.href

Javascript Can';t检索window.location.href,javascript,location-href,Javascript,Location Href,我有以下代码,试图检索新打开窗口的url <script type="text/javascript"> this.windowRef = window.open("http://www.google.com"); console.log(this.windowRef.location.href); </script> this.windowRef=window.open(“http://www.google.com"); console.log(this.windo

我有以下代码,试图检索新打开窗口的url

<script type="text/javascript">
this.windowRef = window.open("http://www.google.com");
console.log(this.windowRef.location.href);
</script>

this.windowRef=window.open(“http://www.google.com");
console.log(this.windowRef.location.href);
然而,当我看到浏览器的控制台时,显示的结果是:“about:blank”,而不是“www.google.com”

为什么呢?如何显示www.google.com

感谢您的帮助。

阻止您从其他域读取数据