Display a warning when leaving the site, not just

2019-01-09 07:39发布

This sounded like something almost impossible to do when it was presented to me. I know you can display a dialog box to confirm when leaving a web page. But is it possible to display a dialog box when leaving a site?

I haven't been able to find/create anything that can read the address bar and know that you're leaving the site.

7条回答
Luminary・发光体
2楼-- · 2019-01-09 08:02

It's possible. Just try entering a question or answer to SO and then navigating away before submitting it. It doesn't matter whether you click on a link or type in the address bar, you get an "Are you sure?" alert. You might post over on SO Meta asking how they do this.

查看更多
登录 后发表回答