webview 使用 HTTPS

问题描述

我想在我的应用程序中使用带有地理定位的地图,但出现错误提示我使用 https 而不是 http。 我不知道如何使用我的 webview 来停止出现问题。你有一个简单的解决方案吗?

             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);

我对您提供的所有解决方案都感兴趣,以解决我的代码问题。

我想了解更多。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)