add multiple window.onload and onerror events