I have the following html code:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<h1>Soemething</h1>
<button id='btn'>Take me to Google</button>
<script>
document.getElementById('btn').addEventListener('click', doStuff);
function doStuff() {
window.location.assign("https://www.google.com/");
}
</script>
</body>
</html>
How do I wait for Google to load before executing code on google.com such as doing a search?
Thank you