打开本地文件中的Webkit .NET [英] Opening local files in Webkit .NET
问题描述
一个简单的WebKitBrowser1.Navigate(localfilehere)不会出于某种原因。
A simple WebKitBrowser1.Navigate(localfilehere) doesn't work for some reason.
我尝试添加文件://的网址,但没有工作,要么
I tried adding "file://" to the URL but that didn't work either.
这似乎是可笑的,但这个功能真的不present?
This seems ridiculous but is this functionality really not present?
推荐答案
它看起来像你把错误的URL。您可以通过
Its look like you put wrong url. You can check it by
Uri.IsWellFormedUriString
其中一个原因 - 你把字符串国家象征
One of the reasons - you put the string with national symbols.
在这种情况下,答案之前没有解决你的问题,因为你也应该连接code网址。
In this case the answers before do not resolve you problem, because you also should encode url.
您可以使用 System.Web.HttpUtility.UrlEn code
它,然后应用的解决方案说明
之前由 X企业(但你不应该替换的空间 - 这将是已经完成的编码)。
You can use System.Web.HttpUtility.UrlEncode
for it and then apply a solution described
before by X Enterprises (but you should not replace spaces - it would be already done by encoding) .
但要获得正确的URL最简单的方法就是
But the easiest way to get correct url is
string url = new Uri(pathToFile, UriKind.Absolute).AbsoluteUri;
这篇关于打开本地文件中的Webkit .NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!