Add ready event listener to ensure JS isn't killed.