# external js file

**URL:** https://forum.kirupa.com/t/external-js-file/658428
**Category:** programming
**Created:** [April 27, 2023, 1:31pm UTC](https://forum.kirupa.com/t/external-js-file/658428 "2023-04-27T13:31:59Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![asparker](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/asparker/32/20942_2.png) [@asparker](https://forum.kirupa.com/u/asparker)
#### Post date: [April 27, 2023, 1:31pm UTC](https://forum.kirupa.com/t/external-js-file/658428/1 "2023-04-27T13:31:59Z")

</div>

I need to have my external projectjs.js file placed after the opening body tag I usually place it before the closing body tag. If I place it after the opening body tag my program fails to load  
Thank you for your help!

---

<div class="post-metadata">

### Author: ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)
#### Post date: [April 27, 2023, 3:50pm UTC](https://forum.kirupa.com/t/external-js-file/658428/2 "2023-04-27T15:50:18Z")

</div>

Hi @asparker - do you see any errors in your browser DevTools Console? Is your external JS file relying on the contents of the page to function? If so, then having your code at the top of your document (after the opening `body` tag) may cause problems.

Just out of curiosity, why do you have to have your JS file be placed at the top instead of the bottom? 🙂

Cheers,  
Kirupa

---

<div class="post-metadata">

### Author: ![asparker](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/asparker/32/20942_2.png) [@asparker](https://forum.kirupa.com/u/asparker)
#### Post date: [April 27, 2023, 3:53pm UTC](https://forum.kirupa.com/t/external-js-file/658428/3 "2023-04-27T15:53:33Z")

</div>

It is part of my final project requirements

---

<div class="post-metadata">

### Author: ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)
#### Post date: [April 27, 2023, 4:42pm UTC](https://forum.kirupa.com/t/external-js-file/658428/4 "2023-04-27T16:42:37Z")

</div>

Gotcha! That’s understandable 🙂

What errors do you see when you view your browser’s devtools console?
