Skip to content

Instantly share code, notes, and snippets.

@gavinblair
Created June 16, 2010 15:26
Show Gist options
  • Save gavinblair/440848 to your computer and use it in GitHub Desktop.
Save gavinblair/440848 to your computer and use it in GitHub Desktop.
//if animations crash due to excessive tapping, refresh the page
var crashchecker = setInterval(function(){
if ($(".current").length == 0) {
window.location="/";
clearInterval(crashchecker);
}
}, 500);
@SeanJA
Copy link

SeanJA commented Jun 16, 2010

You might want to show a confirm() thing to make sure they know what is going on...

if (confirm('The page seems to have stopped responding properly, do you want to refresh the page? (you will lose all your unsaved data)')){/*refresh*/}

If they are entering data, they will lose it if you just randomly refresh the page on them.

@gavinblair
Copy link
Author

The issue is that it crashes between animations and takes you to a black screen. If the page is installed as an app, there is no way to refresh - you'd have to quit and restart the app.

The good news is, jQTouch apps use ajax so things should be saved as you go.

@SeanJA
Copy link

SeanJA commented Jun 16, 2010

Thats kinds lame... I guess your way makes sense then, but I think I would do $('body') instead just because then I don't have to go changing it for each project / page / whatever...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment