AnsweredAssumed Answered

HTML: Getting GPS coordinates in Web Viewer

Question asked by barand on Jan 22, 2019
Latest reply on Jan 23, 2019 by CarlSchwarz

Hello,

I want to get the GPS coordinates in WebDirect. I am trying to accomplish this with WebViewer.

I have html code that works correctly when opening it directly in the browser.

 

But it does not work when I want to open it in WebViewer. I have pasted the HTML in a text field and have it looked up by WebViewer.

 

The code that I have inserted in the text field is as follows:

<html>
  <head>
  <meta http-equiv="content-type" content="text/html"; charset="UTF-8" />
  <script
      src="https://code.jquery.com/jquery-2.1.4.min.js"
      integrity="sha256-8WqyJLuWKRBVhxXIL1jBDD7SDxU936oZkCnxQbWwJVw="
      crossorigin="anonymous"></script>
  <link rel="stylesheet" type="text/css" href="styles.css">
  </head>
  <body>

 

  <script>
          $('document').ready(function(){

 

            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(function(position){
                  console.log(position);

 

                });

 

            }
          });
  </script>
  </body>
</html>

 

 

Any idea if it is possible, if so what should I change in the code?

 

Kind regards,

 

Baran

Outcomes