CefSharp动态添加jq库的方法

(function () {
    function getScript(url, success) {
        var script = document.createElement('script');
        script.src = url;
        var head = document.getElementsByTagName('head')[0],
            done = false;
        script.onload = script.onreadystatechange = function () {
            if (!done && (!this.readyState
                || this.readyState == 'loaded'
                || this.readyState == 'complete')) {
                done = true;
                success();
                script.onload = script.onreadystatechange = null;
                head.removeChild(script);
            }
        };
        head.appendChild(script);
    }
    getScript('http://libs.baidu.com/jquery/2.1.4/jquery.min.js', function () {
        if (typeof jQuery == 'undefined') {
            console.log('加载失败');
        } else {
            console.log('加载成功' );

            $(document).ready(function () {


            });
        }
    });
})();

 

你可能感兴趣的:(C#,.net)