我在Windows Phone 8中具有Web浏览器控件。我想在Web浏览器控件中加载html。

我的html字符串是

string htmlstring=
   " <html>
    <head>
    <title>Kayako chat</title>
    </head>
    <body><!-- BEGIN FUSION TAG CODE - DO NOT EDIT! -->
    <div>
    <div id=\"proactivechatcontainer6bahdzbxzq\">
    </div>
    <table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">
    <tr><td align=\"center\" id=\"swifttagcontainer6bahdzbxzq\">
    <div style=\"display: inline;\" id=\"swifttagdatacontainer6bahdzbxzq\">
    </div>
    </td></tr>
    </table>
    </div>
    <script type=\"text/javascript\">
    var swiftscriptelem6bahdzbxzq=document.createElement(\"script\");
    swiftscriptelem6bahdzbxzq.type=\"text/javascript\";
    var swiftrandom = Math.floor(Math.random()*1001);
    var swiftuniqueid = \"6bahdzbxzq\";
    var swifttagurl6bahdzbxzq=\"http://kcs.kayako.com/visitor/index.php?/Default/LiveChat/HTML/HTMLButton/cHJvbXB0dHlwZT1jaGF0JnVuaXF1ZWlkPTZiYWhkemJ4enEmdmVyc2lvbj00LjUzLjI2MzMmcHJvZHVjdD1GdXNpb24mY3VzdG9tb25saW5lPWh0dHAlM0ElMkYlMkZrY3Mua2F5YWtvLmNvbSUyRl9fc3dpZnQlMkZmaWxlcyUyRmZpbGVfY3ViOWcyZXJiZ21yYTM2LnBuZyZjdXN0b21vZmZsaW5lPWh0dHAlM0ElMkYlMkZrY3Mua2F5YWtvLmNvbSUyRl9fc3dpZnQlMkZmaWxlcyUyRmZpbGVfMGdrOWo4a3Q2a21ubjljLnBuZyZjdXN0b21hd2F5PWh0dHAlM0ElMkYlMkZrY3Mua2F5YWtvLmNvbSUyRl9fc3dpZnQlMkZmaWxlcyUyRmZpbGVfc25nMDRlcmI0cnhnZGZpLnBuZyZjdXN0b21iYWNrc2hvcnRseT1odHRwJTNBJTJGJTJGa2NzLmtheWFrby5jb20lMkZfX3N3aWZ0JTJGZmlsZXMlMkZmaWxlXzAwZWw3bHAxaDBoZXRtZy5wbmcKYjIxOWVhMTFkMWQ1ZDA4ZmM2NWQyMTBkOTFmN2JkYjk2NjExNjNhYQ==\";
    setTimeout(\"swiftscriptelem6bahdzbxzq.src=swifttagurl6bahdzbxzq;
    document.getElementById('swifttagcontainer6bahdzbxzq').appendChild(swiftscriptelem6bahdzbxzq);\",1);
    </script><!-- END FUSION TAG CODE - DO NOT EDIT! -->
    </html>";


我这样做了但是没用

var htmlCode = HttpUtility.HtmlDecode(htmlString);
WebView1.NavigateToString(htmlCode);

最佳答案

最好的方法是:

webbrowser1.documenttext = "Html"


如果不起作用:

        wb.Navigate("");
        do
        {
            Application.DoEvents();
        } while ((wb.ReadyState != WebBrowserReadyState.Complete));
        wb.Document.Body.InnerHtml = "Html";

关于javascript - 如何在wp8网络浏览器控件中使用javascript加载html?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16543180/

10-12 12:37