Boss mentioned a function, is to make a good mobile phone site Http://xxx.com/m/home/index, think it should be quite simple, an HTML page in an IFRAME is good, and then the width and height are set to 100%, try the next, Width no problem , is the height of the words 100% is no use, tried in my MX2 mobile phone is 100% Open, tantalum is in the colleague's Huawei mobile phone can not open up, Internet search, you can use JS to get the height of the entire window, the following is the code, directly written in the new MUI The index.html page in the project.
<! DOCTYPE html>
<meta charset= "Utf-8" >
<meta name= "viewport" content= "initial-scale=1.0, maximum-scale=1.0, User-scalable=no"/>
<title></title>
<style>
* {
margin:0;
padding:0;
}
</style>
<script type= "Text/javascript" >
Document.addeventlistener (' Plusready ', function () {
Console.log ("All plus APIs should be called after this event occurs, otherwise the plus is undefined will appear.") "
var h = plus.webview.currentWebview (). Height; This is wrong, no value is taken
Console.log ("current page URL:" + Plus.webview.currentWebview (). GetURL () + ", Current window Height:" + h);
document.getElementById (' Frm1 '). Style.height = h + "px";
});
function Setiframeheight (IFRAME) {
if (IFRAME) {
var Iframewin = Iframe.contentwindow | | Iframe.contentDocument.parentWindow;
if (iframeWin.document.body) {
Iframe.height = IframeWin.document.documentElement.scrollHeight | | IframeWin.document.body.scrollHeight;
Console.log ("window height:" + iframe.height);
document.getElementById (' Frm1 '). Style.height = iframe.height + "px";
}
}
};
Window.onload = function () {
Setiframeheight (document.getElementById (' Frm1 '));
};
</script>
<body>
<iframe id= "Frm1" style= "border:none;width:100%;height:100%;" src= "http://baidu.com/" ></iframe>
</body>
MUI packaged mobile version of the website is apk