0

I want to use a map with geolocation in my application and I have an error telling me to use https instead of http. I don't know how to use my webview to stop having the problem. do you have a simple solution?

             string myHtml = @"<html>
<head>
<meta charset='utf-8' />
<meta content='width=device-width,initial-scale=1.0' name='viewport' />
<link href='https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css' rel='stylesheet'>
<link rel='stylesheet' href='https://www.alerte-inondation.com/source-soft/map/leaflet.css' />
<link rel='stylesheet' href='https://www.alerte-inondation.com/source-soft/map/L.Control.Locate.min.css' />
<style type='text/css'>
</style>
</head>
<body>
<div id='map' style='width:100%; height:300px; margin: 0 auto'></div>

<script src='https://www.alerte-inondation.com/source-soft/map/leaflet@17.js'></script>
<script src='https://www.alerte-inondation.com/source-soft/map/L.Control.Locate.js'></script>
<script  type='text/javascript'>

var osmUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var osmAttrib='';
        var osm = new L.TileLayer(osmUrl, {
attribution: osmAttrib,
detectRetina: true
});



var map = new L.Map('map', {
tap: false,
layers: [osm],
center: [51.505, -0.09],
zoom: 10,
zoomControl: true
});

lc = L.control.locate({strings: {title: 'Montre-moi où je suis !'}}).addTo(map);

</script>
</body>
</html>";


        //MapView.Settings.UserAgentString = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11";
        //MapView.SetWebViewClient(new WebViewClient());
        
        
        MapView.Settings.UseWideViewPort = true;
        MapView.Settings.LoadWithOverviewMode = true;
        MapView.Settings.JavaScriptCanOpenWindowsAutomatically = true;
        MapView.Settings.AllowContentAccess = true;
        MapView.Settings.LoadsImagesAutomatically = true;
        
        // Début pour prendre en compte HTML5
        MapView.Settings.DatabaseEnabled = true;
        MapView.Settings.SetAppCacheEnabled(true);
        MapView.Settings.DomStorageEnabled = true;
        // fin
      
        MapView.SetWebChromeClient(new WebChromeClient());
        MapView.Settings.SetGeolocationEnabled(true);
        MapView.Settings.JavaScriptEnabled = true;

       MapView.LoadDataWithBaseURL(null, myHtml, "text/html", "UTF-8", null);

I am interested in all the solutions you can give me to solve my problem with my code.

I want to learn more.

Jason
  • 86,222
  • 15
  • 131
  • 146
michael
  • 25
  • 7
  • what is the **specific** error message, and how is it surfaced? ie, it an exception, or a compiler error, or a console message at runtime? – Jason Feb 24 '21 at 19:20
  • @Jason https://www.alerte-inondation.com/erreur.jpg when I click on my geolocation request button I get an error with the message. – michael Feb 24 '21 at 19:31
  • on my site, I have no problem with the https - https://www.alerte-inondation.com – michael Feb 24 '21 at 19:35
  • if you don't have https on your site try https://www.cloudflare.com/ create an account, add a domain, it will ask you to point nameservers.... follow the steps, and you can add options like "allways use https".... this way you'll have a https – Jintor Feb 24 '21 at 23:43

0 Answers0