移动应用上带有 google 个地图的 Iframe

Ifream with google maps on mobile app

我为 android 构建和应用程序使用 google 地图嵌入了我的框架所有这些都在英特尔 xdi 加上 cordova 在 html5 问题是有时 apk 显示全黑和它没有显示地图或不是很好的中心有时看起来很好但是就像随机的请一些建议所以修复

<html>
<head></head>
<body>
<style>
.wrapper {
 position: relative;
 padding-bottom: 165%; // This is the aspect ratio
 height: 0;
 overflow: hidden;
        }
       .wrapper iframe {
         position: absolute;
         top: 0;
         left: 0;
         width: 100% !important;
         height: 93% !important;
                    }
</style>


<div class="wrapper">

  <iframe src="http://mapbuildr.com/frame/hc0v2v" frameborder="0"></iframe> </div>
</body>
</html>

一些旧的 android 设备不会立即初始化高度和宽度,请尝试在 Cordova deviceready 事件触发后加载地图,这是我测试的示例代码,它会在 deviceready 事件触发后加载 iframe src:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <style>
        .wrapper {
            position: relative;
            padding-bottom: 165%; // This is the aspect ratio
            height: 0;
            overflow: hidden;
        }
        .wrapper iframe {
            position: absolute;
            top: 0;
            left: 0;
            width: 100% !important;
            height: 93% !important;
        }
    </style>
    <script src="cordova.js"></script>
    <script>
        document.addEventListener("deviceready", function(){
            document.getElementById("map").src = "http://mapbuildr.com/frame/hc0v2v"; 
        }, false);
    </script>    
</head>
<body>
    <div id="mapa_2" class="upage-content vertical-col left hidden">
        <div class="wrapper">
            <iframe id="map" src="" frameborder="0"></iframe>
        </div>
    </div>
</body>
</html>