Automatically get screenshot by Javascript