使用 ionic 的 iframe 封装 web App 时可能会遇到没法全屏,页面连接没法点击等问题,这里展现下如何解决此问题javascript
<ion-content scroll="true" overflow-scroll="true"> <iframe ng-src='{{myUrl}}' class="width-100 height-100" style="min-width: 100%;min-height: 100%;"> </iframe> </ion-content>
ion-content 要设为 scroll="true" overflow-scroll="true"html
iframe 要设为 class="width-100 height-100" 同时还要设置 min-width 和 min-height 为 100%,这样才能够全屏java
angular.module("start.controllers", []) .controller('IndexCtrl', function($scope, $http, $sce) { var url = "http://m.yoururl.com"; $scope.myURL = $sce.trustAsResourceUrl(url); });
在 ionic 的 controllers 模块中找到对应的页面控制器,这里我是用的是 IndexCtrl,引入 $sce,而后设置信任的网址便可。web
在项目根目录下的config.xml中添加 access 控制apache
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist/安全
<!-- Don't block any requests --> <access origin="*" />