I need to load an external js file into a html file AFTER the page loads. This is because in this external js file a variable only updates itself after the html file loads.
that being said i also need to use the function showScreen afterwards. showScreen is a boolean in the external js file.

I only want it to switch screens when showscreen is true and that can only load after the html file loads. So right now if i did window.onload = showScreen in the html, it is always undefined

external.js ( this is part of the external file and the function Im trying to use)

```
function showScreen(showTraditionalScreen) {
   console.log("showTraditionalScreen "+ showTraditionalScreen);
   return showTraditionalScreen;
}

```

UPDATE:

index.html (this is the bottom half of the file where i want to make the changes)

```
<script src="js/main.js"></script>
        <script src="js/additions.js"></script>
        <script src="../server/webcam.js" defer></script>
        <script>
           if(window.onload =showScreen)
              window.location.href = "traditional.html";
           }
       </script>
    </body>
 </html>

```

it currently doesnt do anything, but the point is, when showScreen is true the page will change to traditional.html. Currently it doesnt do that

this file is also asynchronous, so the console.log continues to print true or false 

I know ajax is a good option and i have been experimenting but im still a little lost. 

how do i use the external.js function in an html file after the page loads?
Why isnt my file currently allowing me to use showscreen?