Check Online / OffLine

The API requires a token now.

So you would use server side code to generate an App Access Token.
And use that to perform lookups on the API

Alternatively if using server side you can eventsub and collect live status into a database, and Twitch will tell you when a stream starts or ends.

You cannot and should not generate an app access token in the front end as that would leak what is essentially a password, and I don’t think you want to use an implicit auth as you don’t want to be having random website visitors login to generate a token to use.

So in summary, you need some server side code.

Something like this would be suitable if you have access to PHP

Then use the resultant token with the Get Streams API - Reference | Twitch Developers and collect the result

Store the stream status result into a database or a file and then load that into your front end display.

For a website with random visitors that you don’t want to nudge for them to login with Twitch with, you need some server side code.