我试图在Windows Phone 7.1的WebBrowser中加载本地文件,但我总是收到异常或空白页。在WebBrowser控件中加载本地文件
我试着用
Stream stream = Application.GetResourceStream(
new Uri("./Html/par/index.html",
UriKind.Relative)).Stream;
using (StreamReader reader = new StreamReader(stream))
{
// Navigate to HTML document string
this.webBrowser.NavigateToString(reader.ReadToEnd());
}
这是发射一个空白页。
我将index.html和所有需要的文件(css/js)设置为Content和IsScriptEnable为“true”。
你知道如何解决这个问题吗?
StreamReader reader = new StreamReader(TitleContainer.OpenStream(“test.html”)); webBrowser1.NavigateToString(reader.ReadToEnd()); 我也使用过这个。问题不在于路径,而是实际上它加载了指定的html,而不是本地脚本/样式文件/图像。 任何想法如何流这些文件呢? – fran 2012-07-05 10:44:15
尝试此链接http://transoceanic.blogspot.co.uk/2011/07/wp7-load-local-html-files-and-all.html – 2012-07-05 10:58:59
谢谢!!它的工作就像一个魅力,但它是一种耻辱,我们有要做到这一点加载本地文件...我希望有第二种方式......但这是最好的答案!干杯! – fran 2012-07-05 12:33:13