Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/459.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_Xss - Fatal编程技术网

使用javascript在当前域外重定向

使用javascript在当前域外重定向,javascript,xss,Javascript,Xss,我想重定向到域外的其他网站,例如: <img src="http://url.to.file.which/not.exist" onerror=window.open("www.google.com","xss",'height=500,width=500');> 我将上述代码放入一个简单的html文件中。但是,当弹出窗口出现时,它会不断在“www.google.com”之前添加文件路径。有办法删除吗?使用完整的URL:窗口。打开(“http://www.google.com“

我想重定向到域外的其他网站,例如:

<img src="http://url.to.file.which/not.exist" onerror=window.open("www.google.com","xss",'height=500,width=500');>


我将上述代码放入一个简单的html文件中。但是,当弹出窗口出现时,它会不断在“www.google.com”之前添加文件路径。有办法删除吗?

使用完整的URL:
窗口。打开(“http://www.google.com“..

要使用绝对url,您需要指定协议。在您的情况下,您需要
http://


所以只要把
www.google.com
改成
http://www.google.com

您错过了域之前的协议

<img src="http://url.to.file.which/not.exist" onerror=window.open("https://www.google.com","xss",'height=500,width=500');>

这是因为您提供了一个相对URI。