Overlay extension doesn't load JS

As my first extension I’m try to program an overlay.
Basically there’s a search bar as HTML and, as the enter key is pressed, JS creates buttons on the screen.
Locally everything works like a charm, also on the rig everything seems perfect, but then when moving to the hosted test only the HTML is loaded and the UI doesn’t respond to the ENTER input.
I uploaded all the files as zip with no folders in it (basically in the zip there are only the 3/4 files needed) and in each HTML page there’s the twitch-helper script invoked.
Did anybody experience such a problem? Any idea on how to solve it?
I am pretty new to JS, so that may be my main problem :smiley:
Thanks.

Can you show your code as to how you’re loading the JS in your HTML file? A common error is using an absolute path, rather than a relative path, to the JS file which will work in the rig but not work in hosted testing as your extension files aren’t at the root path so absolute links will 404.

Hello, thanks for your reply.
my html looks like so:

<body>
<div class="searchbarDiv">
    <input id="searchbar" onkeyup="getRequestedHero(event)" type="text" placeholder="Search hero..">
    <button class="button" style="vertical-align:middle" onclick="clearButton()"><span> + </span> </button>
</div>
<div class="boxDiv" id="boxDiv"> 
    <div class="tooltipDiv" id="tooltipDiv"></div>
    <div class="labelsDiv" id="labelsDiv"></div>
</div>
<!--import extension helper library -->
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
<script src="script.js"></script>
</body>

I think your “onkeyup” and “onclick” eventhandler might the issue, as those count as “inline JS” which isn’t permitted by policy when running from the Twitch CDN.

You might need to attach those events from your JS code instead of using the attributes.

This was the problem. Everything works fine now! Thank you both :slight_smile: