I created a redirect function to redirect page when user submits input to the search box. When user search something, it will redirect to some webpage. Let's say that redirected url is "http://www.google.com" (In real, I used different URL to redirect, but just picked google.com for example) and below is what I created.
<script>
function redirect(){
window.location = "http://www.google.com";
return false;
}
</script>
The question is----
How can I be able to run another JavaScript <script>alert("hi")</script>
when http://www.google.com webpage is successfully loaded?
I'm very new to JavaScript and HTML code, so any advise would be appreciated!