本文介绍了Webkit显示空白页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在C#.net中使用WebKit。
在WEBKIT中加载此页面时遇到麻烦。

WEBKIT成功显示其他网页内容
,但在上述网页的情况下。有
个空白网页。没有页面原始内容。
,而此页面在Firefox,Opera浏览器中运行正常。
对此有任何帮助吗?
感染这不是唯一的页面。
表示敬意。

I am currently using WebKit in C# .net.I am facing trouble while loading this page in WEBKIT.http://shop.orange.co.uk/mobile-phones/4g-ready-phones or http://www.vax.co.uk/WEBKIT showing other web pages content successfullybut in case of the above web page. there isa blank web page. there is not Page original Content.while this page is working fine in Firefox, Opera browsers.any help regarding this ?Infect this is not the only page.regards.

推荐答案

我发现无法用webkitdotnet项目检查或调试html / javascript。

I found no way to inspect or debug html/javascript with webkitdotnet project. And it seems it's not maintained a while.

因此,如果您有能力迁移到其他Web引擎,我建议使用。我相信它是功能强大的引擎,具有webkitdotnet的所有功能,并且它还可以附加Chrome浏览器检查器来调试页面。为此,您需要设置RemoteDebuggingPort属性:

So if you have ability to move to other web engines, I would recommend CefSharp - Embedded Chromium for .NET. It's powerful engine that, I believe, has all capabilities webkitdotnet has, and also it allows to attach Chrome browser inspector to debug the page. To do this, you need to set RemoteDebuggingPort property:

var settings = new CefSettings();
settings.RemoteDebuggingPort = 8088;

Cef.Initialize(settings);

然后您可以打开url http:// localhost:8088 在您的Chrome浏览器中,以附加在您的应用程序中运行的嵌入式引擎。

Then you can open url http://localhost:8088 in your Chrome browser to attach embedded engine that runs in your app.

CefSharp项目的源代码包含WinForms和WPF应用程序的示例。您可以轻松地从以下示例开始。

CefSharp project's sources contain examples of both WinForms and WPF applications. You can start easily with this examples.

更新:在撰写本文时,CefSharp组件不支持将全页快照作为图像。 。我在分支的中创建了ChromiumWebBrowserWithSnapshotSupport类。 。我已经修改了CefSharp.Wpf.Example项目,并添加了Snapshot按钮,该按钮可以制作页面快照并打开图像。您还可以使用。

UPDATE: In the moment of writing CefSharp component doesn't support taking full page snapshots as an image. I created ChromiumWebBrowserWithSnapshotSupport class in a forked branch https://github.com/ivan-sam/CefSharp . I've modified CefSharp.Wpf.Example project and added Snapshot button that makes snapshot of the page and opens an image. You also can put this control on WinForms form using ElementHost.

如果您无法移动,我看到的唯一可用选项是在本地下载受影响的页面以及所有相关内容(脚本,css等),并将其托管在本地Web服务器上。然后按照本文中的说明进行修改,以使用(-俄语):

If you can't move, the only available option I see is to download affected page locally with all related content (scripts, css and so on), and host it with local web server. Then modify it to use Firebug Lite as described in this article (http://habrahabr.ru/post/154917/ - it's in Russian):

<!DOCTYPE html>
<html>
<head>
    ...

    <script type='text/javascript' src='/path/to/firebug-lite.js'>
    {
        overrideConsole: true,
        startInNewWindow: true,
        startOpened: true,
        enableTrace: true
    }
    </script>

    ...
</head>
<body>...</body>
</html>

并允许在新窗口中打开Firebug,您应该添加以下C#代码:

and to allow Firebug to be open in a new window you should add the following C# code:

browser.Url = new Uri(
    "http://localhost/path/to/debug-version-of-interface.html",
    System.UriKind.Absolute);

browser.NewWindowCreated += new NewWindowCreatedEventHandler(
(sender, newWindowEventArgs) =>
{
    // create new form with single item - Firebug Lite window
    debuggerForm = new DebuggerForm(newWindowEventArgs.WebKitBrowser);
    debuggerForm.Show();
});

Firebug lite可让您访问页面的HTML DOM和JavaScript控制台。

Firebug lite gives you access to HTML DOM of the page and JavaScript console.

调试愉快^)

这篇关于Webkit显示空白页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 00:38