首页 > 技术文章 > cefsharp 获取高度

romanticcrystal 2018-12-26 13:28 原文

G.browser.GetBrowser().MainFrame.ExecuteJavaScriptAsync("$(document).height()");

 

 

 

// Get Document Height  
var task = frame.EvaluateScriptAsync("(function() { var body = document.body, html = document.documentElement; return  Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); })();", null);

task.ContinueWith(t =>  
{  
    if (!t.IsFaulted)  
    {  
        var response = t.Result;  
        EvaluateJavaScriptResult = response.Success ? (response.Result ?? "null") : response.Message;  
    }  
}, TaskScheduler.FromCurrentSynchronizationContext());  

 

推荐阅读