Please how to I enable GPS inside an Iframe


<!DOCTYPE html>
<html>
<head>
    <title>GPS</title>
    <script type="text/javascript" src=" https://cdnjs.cloudflare.com/ajax/libs/webcamjs/1.0.25/webcam.js "></script>
   <script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
    </script>


    <style>
     
    </style>
</head>
<body>
  
</body>
<script>

getLocation()    
function getLocation() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(showPosition);
  } else {
    window.alert("Geolocation is not supported by this browser.");
  }
}

function showPosition(position) {
  window.x= []
  window.x.push(position.coords.latitude)
  window.x.push(position.coords.longitude);
console.log("THE X IS", window.x)
//////////////////////////////////
        

}  


</script>
</html>


This is the entire code. works on a a html page but does not work in Wix html component