我想重定向到我域外的另一个网站,例如:
<img src="http://url.to.file.which/not.exist" onerror=window.open("www.google.com","xss",'height=500,width=500');>
我把上面的代码放到了一个简单的html文件中。但是,当弹出窗口出现时,它会一直在“www.google.com”之前附加文件路径。有办法去除吗?
最佳答案
您错过了协议(protocol) - http(s)://
- 在域之前
<img src="http://url.to.file.which/not.exist" onerror=window.open("https://www.google.com","xss",'height=500,width=500');>
关于javascript - 使用javascript重定向到当前域之外,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7172732/