在重定向之前,Javascript会显示警报两次

Jak*_*ake 0 javascript alert

<script type="text/javascript">
<!--

alert('You will be redirected');


window.location = "http://www.google.com/"

//-->
</script>
Run Code Online (Sandbox Code Playgroud)

如何更改代码,以便在重定向到谷歌之前显示警报两次?

Her*_*rms 7

<script type="text/javascript">
<!--

alert('You will be redirected');
alert('You will be redirected');


window.location = "http://www.google.com/"

//-->
</script>
Run Code Online (Sandbox Code Playgroud)

为什么你想要这样做我不知道,但那会做你想要的.