您如何为任何外部链接设置警告消息,以使用户知道他们正在离开您的网站并转到另一个网站?
<div class="row">
<div class="col-lg-12">
<div class="form-group">
*For a list of all other forms not listed above that may be applicable - <a href="" target="_blank"><span class="noprint">(click here to print)</span></a>
</div>
</div>
</div>
答案 0 :(得分:0)
您可以使用beforeunload函数执行此操作:
在Jquery中
$(window).bind('beforeunload', function(){
return 'Are you sure you want to leave?';
});
使用Java语言
window.onbeforeunload = function(){
return 'Are you sure you want to leave?';
};