最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Error while using exit(0) in javascript - Stack Overflow

programmeradmin1浏览0评论
var inDoubleTap = false; // Shared across all bound elements
return $list.live('touchstart', function(e) {
    if (e.originalEvent.touches.length === 1) {
        if (!inDoubleTap) {
            inDoubleTap = true;
            setTimeout(function() { inDoubleTap = false }, delay);
        } else {
            inDoubleTap = false;
            callback.call(this, e);
            exit(0);
        }
    }
});

The above code shows an error if i use exit(0) in mobile browsers (iphone, ipad)

var inDoubleTap = false; // Shared across all bound elements
return $list.live('touchstart', function(e) {
    if (e.originalEvent.touches.length === 1) {
        if (!inDoubleTap) {
            inDoubleTap = true;
            setTimeout(function() { inDoubleTap = false }, delay);
        } else {
            inDoubleTap = false;
            callback.call(this, e);
            exit(0);
        }
    }
});

The above code shows an error if i use exit(0) in mobile browsers (iphone, ipad)

Share Improve this question edited May 19, 2011 at 8:56 Félix Saparelli 8,7496 gold badges55 silver badges68 bronze badges asked May 19, 2011 at 8:49 TarunTarun 132 silver badges9 bronze badges 2
  • 5 Under no circumstance tell us what error you're getting exactly - it would spoil the fun of guessing! – Pekka Commented May 19, 2011 at 8:51
  • 3 What did you expect exit(0) to do? Close the browser? Seriously, I'd like to understand your reasoning. – Zecc Commented May 19, 2011 at 8:56
Add a ment  | 

1 Answer 1

Reset to default 4

Surely you mean return; instead of exit(0). That should work.

发布评论

评论列表(0)

  1. 暂无评论