Ionic App中嵌入外部网页的问题
在app中不可避免的要引用第三方的页面,那么在Ionic中是如何实现呢?
1.设计引用外部页面的html框架页面,分3部分,表头有2个按钮,中间是引用的页面,底部隐藏分享相关按钮,具体页面如下:
<ion-view title="{{title}}" > <ion-nav-buttons side="left">
<a class="button button-icon ion-ios-arrow-back" ng-click="toClose()"></a>
</ion-nav-buttons> <ion-nav-buttons side="right">
<button class="button button-icon icon ion-android-share-alt" ng-disabled="showShare" ng-click="share()"></button>
</ion-nav-buttons> <ion-content >
<iframe id="extendIf" name="extendIf" ng-src="{{::plink}}" allowtransparency="true" allowfullscreen="true"
allowfullscreenInteractive="true" border="0" frameborder="0" style="width:100%;height:100%;">
</iframe>
</ion-content>
<div class="bar bar-footer ">
<button class="button button-icon ion-ios-arrow-left" ng-click="hisGo(-1)" ng-disabled="hasBack" ></button>
<button class="button button-icon ion-ios-arrow-right" ng-click="hisGo(1)" ng-disabled="hasForward"></button>
<button class="button button-icon ion-ios-loop" ng-click="hisGo(0)"></button>
</div> </ion-view>
主要还是使用了iframe标签。
2.设计对应的Controller层,接收用户的调用,代码如下:
angular.module("ionicApp.controllers")
.controller("OuterHtmlFrameController",function($scope, $stateParams, $interval)
{
function toCheck()
{
var o = $interval(function()
{
var frame = $("#extendIf").contents();
$scope.title = frame.find("title").text();
$scope.showShare = false;
$scope.title && $interval.cancel(o);
}, 100);
}
try
{
$scope.plink = $stateParams.link;
$scope.hasBack = 0;
$scope.hasForward = 0;
toCheck();
$("#extendIf").load(function()
{
toCheck();
$(this).contents().find("[target='_blank']").attr("target", "_self");
}); $scope.hisGo = function(e)
{
//.....
}; $scope.share = function()
{
//.....
};
}
catch (r)
{
$scope.hideLoad();
console.log(r);
}
});
3.调用外部页面
$state.transitionTo("outerHtmlFrame", { link: "http:baidu.com" });// outerHtmlFrame为路由标记名
Ionic App中嵌入外部网页的问题的更多相关文章
- 如何在Android应用中引入外部网页
在某些情况下,我们需要在Android应用中引入外部网页,这里记录一下如何操作(其实很简单^.^). 先介绍一下开发环境: 开发工具:Android Studio 1.5 SDK API版本:17 操 ...
- 转-使用 CefSharp 在 C# App 中嵌入 Chrome 浏览器
使用 CefSharp 在 C# App 中嵌入 Chrome 浏览器 2016-09-23 分类:.NET开发.编程开发.首页精华0人评论 分享到:更多3 本文由码农网 – 小峰原创翻译,转载 ...
- 博客代码:iframe—网页中嵌入其他网页
iframe 是一个可以把另外一个网页嵌入到一个网页里的代码,非常有用.对于一个内容不错的网页,要方便地把它搬到自己的博客里,用这个代码最合适.而对于在新浪博客里不支持的一些网页效果和代码,可先把他们 ...
- 在 C# App 中嵌入 Chrome 浏览器使用 CefSharp
介绍 以前曾试过在app中整合一个可靠又快速的web浏览器吗? 在本文中,你会学到如何轻松地将奇妙的CefSharp网页浏览器组件(基于Chromium)集成到你的C# app中. 然后,你可以使用此 ...
- App中嵌入网页浏览器
TOWebViewController 插件 NSURL *url =[NSURL URLWithString:@"http://192.168.1.134:8180/Home/IndexP ...
- [置顶] ios App 中嵌入应用商店
昨晚同事拿了一个app 发现其app 内部页面打开了appstore 并没有唤起手机自带的appstore, 刚开始以为是用webview 加载的 ,可是自己些了一个demo 发现并不是那样一回事 用 ...
- App中显示html网页
在现在的移动开发中,越来越多的web元素增加到了app里面,hybrid app可以综合native app 和 web app的长处,可以通过webView实现 htmllayout.xml: &l ...
- 安卓app中嵌入一个H5页面,当手机系统设置字体变大时,如何使H5页面的字体不会随用户自己调整的系统字体变化而变化?
webview.getSettings().setTextZoom(100);WebView加上这个设置后,WebView里的字体就不会随系统字体大小设置发生变化了. https://segmentf ...
- C# App 中嵌入 Chrome 浏览器
http://www.codeceo.com/article/cefsharp-charp-app-chrome.html http://developer.51cto.com/art/201304/ ...
随机推荐
- 腾讯X5WebView集成及在移动端中使用
工作中经常涉及H5网页的加载工作,最多使用的就是安卓系统控件WebView,但是当网页内容比较多的时候,需要等待很久才能加载完,加载完后用户才能看到网页中的内容,这样用户需要等很久,体验很差. 那能不 ...
- JdbcTemplate学习笔记(更新插入删除等)
1.使用JdbcTemplate的execute()方法执行SQL语句 jdbcTemplate.execute("CREATE TABLE USER (user_id integer, n ...
- GridSearchCV交叉验证
代码实现(基于逻辑回归算法): # -*- coding: utf-8 -*- """ Created on Sat Sep 1 11:54:48 2018 @autho ...
- [20171107]dbms_shared_pool.pin补充.txt
[20171107]dbms_shared_pool.pin补充.txt --//上午的测试,做一些补充,主要还是一些理解问题. 1.环境:SCOTT@book> @ &r/ver1 P ...
- python 报错RuntimeError: dictionary changed size during iteration
a = {':0} for b in list(a.keys()): if a[b] == 0: del a[b] print(a) 报错是因为在字典迭代期间改变字典大小 我们可以通过取出字典的键值, ...
- mybatis 相关
一.mybatis转义问题 mybatis中SQL在 mapper.xml 中书写时,如果有 < .>.<=.>= 时会出错,应该使用转义的写法. 写法一 转义 < ...
- Linux下如何杀死终端
1.首先是使用who命令查看当前有多少个终端登陆了Linux系统 [root@:vg_adn_tidbCkhsTest /usr/local/redis/bin]#who mobdev pts : ( ...
- ccf题库20170903--Json查询
题目如下: 试题编号: - 试题名称: JSON查询 时间限制: .0s 内存限制: .0MB 问题描述: 问题描述 JSON (JavaScript Object Notation) 是一种轻量级的 ...
- 在Eclipse中使用Maven jetty的debug模式
1.右键项目debug as添加mvn命令: jetty:run 2.进入eclipse的菜单Run->Debug configurations,会看到maven build下对应的项目的mvn ...
- 兼容IE8及以上的常用css选择器
p~ul//位于p元素后边的ul div>p div+p//紧接在 <div> 元素之后的所有 <p> 元素 [attribute]//[target]选择带有 targ ...