Custom UserAgent not detected - SOLVED

I would like to set a condition by checking UserAgent with Javascript. I ran into a problem, that HTMLEXE’s custom UserAgent is not recognized with standard javascript request.

So, if you run a check, navigator.userAgent in Javascript does not recognize custom agent set in HTMLEXE.

I used the code listed here - W3Schools Tryit Editor

I set user agent as Browser123! in HTMLEXE project

But this is what I get when I browse to the page with the script within HTMLEXE - https://i.imgur.com/zhG6ejO.png

How to make a request using Javascript to get Browser123! ?

This is no solution with Javascript for this. It has to be checked by the server.

It was solved with php -

<?php
if ($_SERVER['HTTP_USER_AGENT'] !== 'Browser123!') {
	header('Location: /');
	die('');
}

?>