Go to URL after OK button if alert is pressed

后端 未结 7 581
逝去的感伤
逝去的感伤 2020-12-01 17:33

I need to make sure that when the user clicks OK in a JavaScript alert window, the browser moves to a different URL. Is this possible?

7条回答
  •  悲&欢浪女
    2020-12-01 18:24

    Yes, simply redirect right after the alert() call:

    alert('blah blah');
    location.href = '....';
    

提交回复
热议问题