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.