微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

webview 使用 HTTPS

如何解决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 举报,一经查实,本站将立刻删除。