How would you automatically restart a javascript application when it crashes?
I am interested 开发者_Go百科in running a slideshow in an unattended web browser. I would rather it didn't crash. How should I make sure the javascript application continues to run or the browser reloads the home page when it crashes?
Prepare a frameset with one hidden frame, and your actual content frame as the other. Have a setTimeout running continuously in the hidden frame, which gets reset by the "content" frame from time to time. Lets say that the setTimeout in the hidden frame is 20 seconds, have the content frame reset that timeout (clearTimeout) every 10 seconds or so. If no reset is received (content frame has crashed), force reload the content frame from the hidden frame.
精彩评论