【转】Win10/UWP新特性系列—Web
Internet Explorer
Internet Explorer 在Windows 10 升级为Edge模式,是一种交互性和兼容性都很强的新型浏览器,该浏览器相比以前的版本更新了超过2000个操作性问题,支持20个新平台特性来促进交互性和兼容性。详情: http://blogs.msdn.com/b/ie/archive/2014/11/11/living-on-the-edge-our-next-step-in-interoperability.aspx
WebView Edge mode Browsing
所有Windows 10 系统下的WebView控件使用了相同的浏览器渲染引擎,提供了 统一的html标准。
WebView.UnsupportedUriSchemeIdentified event
新增的WebView.UnsupportedUriSchemeldentified事件能够让WebView捕获到不受支持的uri地址,让我们开发者提供处理这些不受支持的URI方案。
XAML:
C#:
private void OnUnsupportedUriSchemeIdentified (WebView sender, WebViewUnsupportedUriSchemeIdentifiedEventArgs e)
{
// Block all URIs from invoking other apps except the mailto: protocol.
if (e.Uri.Scheme != "mailto")
{
e.Handled= true;
}
}
WebView.NewWindowsRequested event
WebView.NewWindowsRequested事件能在WebView捕获脚本请求一个新的浏览器窗口动作。默认情况下当用户点击一个href或者按钮调用Windows.Open时,会启动默认浏览器来打开请求的导航,现在开发者可以自己捕获该动作,自行处理业务逻辑。
例子中,捕获该事件后创建一个新的WebView控件来显示所请求的内容:
XAML:
C#:
private void OnNewWindowRequested (WebView sender, WebViewNewWindowRequestedEventArgs e)
{
if (e.Referrer.Host == "www.xxxxxx.com")
{
var newWebView = new WebView();
newWebView.Navigate(e.Uri);
myGrid.Children.Add(newWebView);
e.Handled = true;
}
}
WebView.PermissionRequested event
WebView支持最新的Html5技术,有些Html5 Api的调用是需要用户授权的,比如获取地理位置Api,而WebView.PermissionRequested事件能捕捉要求用户许可授权的动作。
WebView.UnviewableContentIdentified event
WebView.UnviewableContentIdentified 事件可以捕获到WebView尝试下载不受支持的文件时发生,当捕捉到该事件后你可以自行处理此事件 并使用Launcher类将文件重定向到浏览器或者其他应用程序。
例子:
C#:
void webView1_UnviewableContentIdentified(WebView sender,
WebViewUnviewableContentIdentifiedEventArgs args)
{
appendLog(String.Format("Content for "{0}" cannot be loaded into webview. " +
"Invoking the default launcher instead.\n", args.Uri.ToString()));
// We turn around and hand the Uri to the
// system launcher to launch the default handler for it.
Windows.Foundation.IAsyncOperation<bool> b =
Windows.System.Launcher.LaunchUriAsync(args.Uri);
pageIsLoading = false;
}
WebView.AddWebAllowedObject method
该方法可以在WebView中添加一个Windows RunTime对象到html Document对象中。该对象必须集成IAgileObject接口并附加AllowForWeb特性。
例子:
C#:
private void navigationStarting(WebView sender, WebViewNavigationStartingEventArgs args)
{
if (args.Uri.Host == "www.contoso.com")
{
myWebView.AddWebAllowedObject("name", new MyClass());
}
}
WebView.ClearTemporaryWebDataAync method
该方法能清除WebView中保存的用户会话状态和缓存数据,来防止另一个用户访问到以前的数据。例如,当用户注销登录时,你可以使用该方法清理WebView控件该用户会话的任何信息。
来自:http://www.wangchenran.com/uwp新技术-web.html
【转】Win10/UWP新特性系列—Web的更多相关文章
- Win10/UWP新特性系列—Launcher实现应用间的通信
UWP中,微软为Windows.System.Launcher启动器新增了很多的功能,以前只能启动App,打开指定扩展名文件,对uri协议的解析,以及当启动的应用没有安装时则会提示前往商店下载等. 如 ...
- Win10/UWP新特性系列—使用打印机
微软在Win10时代终于完成的设备系统的大统一,"56个民族,56支花……"(⊙o⊙)…,既然统一了,那么也就意味着API也统一了,所以在UWP中,我们就可以使用统一的打印API来 ...
- Win10/UWP新特性系列-GetPublisherCacheFolder
微软Windows Runtime App拥有很强的安全模型来防止不同App之间的数据获取和共享,也就是我们所说的"沙盒机制",每个App都运行在Windows沙盒中,App之间的 ...
- Win10/UWP新特性系列—电池报告
UWP中,新增了当节电模式开启时,App能获取到通知的API,通过响应电源条件的更改,比如咨询用户是否使用黑色背景等来帮助延长电池使用时间. 通过Windows.Devices.Power命名空间中的 ...
- Win10/UWP新特性—Drag&Drop 拖出元素到其他App
在以前的文章中,写过微软新特性Drag&Drop,当时可能由于处于Win10预览版,使用的VS也是预览版,只实现了从桌面拖拽文件到UWP App中,没能实现从UWP拖拽元素到Desktop A ...
- Win10/UWP新特性—SharedStorageAccessManager 共享文件
首先先给大家推荐一个UWP/Win10开发者群:53078485 里面有很多大婶,还有很多学习资源,欢迎大家来一起讨论Win10开发! 在UWP开发中,微软提供了一个新的特性叫做SharedStor ...
- 返璞归真 asp.net mvc (10) - asp.net mvc 4.0 新特性之 Web API
原文:返璞归真 asp.net mvc (10) - asp.net mvc 4.0 新特性之 Web API [索引页][源码下载] 返璞归真 asp.net mvc (10) - asp.net ...
- atitit。win7 win8 win9 win10 win11 新特性总结与战略规划
atitit.win7 win8 win9 win10 win11 新特性总结与战略规划 1. win7 1 1.1. 发布时间 2009年10月22日 1 1.2. 稳定性大幅提升,很少蓝屏死机 ...
- Java8新特性系列-默认方法
Java8 Interface Default and Static Methods 原文连接:Java8新特性系列-默认方法 – 微爱博客 在 Java 8 之前,接口只能有公共抽象方法. 如果不强 ...
随机推荐
- SSL Certificates深入理解
http://www.littlewhitedog.com/content-71.html https://www.verisign.com/en_US/website-presence/websit ...
- webpack+express多页站点开发
学习了webpack门级的教程后,觉得可能是专门为单页应用而量身打造的,比如webpack+react.webpack+vue等,都可以解决各种资源的依赖加载.打包的问题.甚至css都是打包在js里去 ...
- asp.net 一般处理程序接收上传文件的问题
在使用Html+ashx处理文件上传时,遇到上传文件超过4M的问题,首先HTML代码如下: <!DOCTYPE html> <html> <head> <me ...
- show tables from information_schema/performance_schema/sys;
root@localhost:3306.sock [performance_schema]>select version();+------------+| version() |+----- ...
- [翻译] NMBottomTabBarController
NMBottomTabBarController A customisable tab bar controller for iOS written in Objective C. It uses a ...
- 解决华为交换机S5700无法解除ip/Mac绑定的问题
今天同事离职,需要解除他的个人笔记本Mac与ip的绑定 首先进入系统用户视图,然后进入vlanif4,解除151绑定 system-view interface vlanif 4 undo dhcp ...
- C++实现一个Vector3空间向量类(转)
转自:http://www.2cto.com/kf/201311/260139.html ector2,3,4类在DirectX中都有现成的可以调用,不过要实现其中的功能其实也不难,也都是一些简单的数 ...
- playfair
又是一道实验吧的题,哈哈,我比较弱. 因为题目写了play我首先想到的是playfair,好,下面先看下百科 好了,已知了密钥: 所以有: s n f m th b g o ui c j p vy d ...
- AT89S52之串行异步通信笔记
SRF 中断入口地址 中断源 外中断 外部中断0 INT0(P3.2) 外部中断1 INT1(P3.3) 电平方式触发 低电平 脉冲方式触发 脉冲后延的负跳 内中断 定时中断 串行中断 中断允许控制寄 ...
- 在Ubuntu Desktop中安装软件
1. 安装好虚拟机后,可以先打开firefox,看是否可以访问外部的网页. 2. 如果在公司内网,可能访问不起,需要添加代理,确保可以访问外部的网页. 3. 更新软件源 sudo apt update ...