加载本地HTML文件中的WebView Metro风格应用程序 [英] Load local html file in WebView Metro Style app

查看:127
本文介绍了加载本地HTML文件中的WebView Metro风格应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有点麻烦装载在Metro风格应用一个WebView控件的HTML文件。
我一直在寻找互联网和发现,你不能加载本地HTML文件的方法的NavigateTo。我还发现,有一种变通方法,您可以使用该控件的方法NavigateToString。下面是我看到这个链接:
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/9cd8614d-2dc8-48ac-9cd9-57b03a644930

I'm having a bit of trouble loading an html file in a WebView control in a metro style app. I've been searching the internet and found out that you can't load a local html file with the NavigateTo method. I also found out that there is a workaround in which you can use the NavigateToString method of the control. Below is the link where i saw this: http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/9cd8614d-2dc8-48ac-9cd9-57b03a644930

有人在该主题的一个帖子就如何可以这样做的例子。他们用和一个字节数组中,他们把数据,他们从调用IInputstream.ReadAsync方法获得。我跑进问题是,之后,我调用该方法的字节数组是充满0的,我不认为是好的。谁能帮我这个?

Someone in a post on that topic gave an example on how this could be done. They used and a byte array in which they put the data they obtained from calling the IInputstream.ReadAsync method. The problem I've ran into is that after i call that method the byte array is full of 0's, which i don't think is ok. Can anyone help me with this?

推荐答案

您可以使用 MS-APPX的Web切换上下文:/// 的协议,而不是 MS-APPX:/// ,其中我已经有成功加载本地HTML文件和相关的CSS和JavaScript ,一个HTML中/ JS Metro风格应用程序。

You can switch contexts by using the ms-appx-web:/// protocol instead of ms-appx:///, which I've had successfully loading local Html files and associated CSS and JavaScript, within a HTML/JS Metro Style App.

我不是在XAML Metro风格应用程序尝试这样做,但相信 MS- APPX的web:/// 协议可以使用。该限制是你的HTML(如果本地没有即网络托管)具有居住的 的内WinRT的包,它出现在你的情况下,即/资产。

I've not tried this in a XAML Metro Style App, but believe that the ms-appx-web:/// protocol can be used. The limitation is that your Html (if local i.e not web hosted) has to reside within a WinRT package, which it appears to in your case i.e. /Assets.

这篇关于加载本地HTML文件中的WebView Metro风格应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆