0

I have one camera device connected to the same network with my computer, when I'am typing the IP of the camera URL in the browser's address bar and press return, a simple normal HTTP GET request is sent to camera and the camera is opening, I want to make a web page interface with buttons and send get requests to camera, using javascript I implemented the following code:

<!DOCTYPE html>
<html>
<head>
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<button onclick="call();">Make a request</button>
</body>

<script>
    function call()
    {
        var url = "http://1**.***.**.***";
        
        var xhr = new XMLHttpRequest();
        xhr.open("GET", url);
        
        xhr.onreadystatechange = function () {
           if (xhr.readyState === 4) {
              console.log(xhr.status);
              console.log(xhr.responseText);
           }};
        
        xhr.send();     
    }
    </script>


</html>

But when I'am clicking the button this error is appearing in the browser console: ERROR IMAGE

I also used this site https://reqbin.com/ to make the get request with an online tool, when I paste the camera url and I pressed the click button a popup appears with this message "Add the ReqBin Google Chrome Extension to your browser to send requests to the localhost and servers on your local network" when I added the extension the get request was sent and the camera opened without errors.

I'am trying to find a solution 3 days but nothing. Thanks in advance for your help.

mplungjan
  • 169,008
  • 28
  • 173
  • 236

0 Answers0