VB.NET webbrowser脚本错误

时间:2015-05-03 14:19:45

标签: javascript vb.net webbrowser-control

最近我能够在使用以下代码下载源代码之前在webbrowser中加载javascript:

WebBrowser1.Document.Window.DomWindow.execscript("text/JavaScript")

    Dim MSDNpage2 As String = WebBrowser1.Document.Body.InnerHtml

    My.Computer.FileSystem.WriteAllText("e:\msdn2.txt", MSDNpage2, True)

    RichTextBox6.Text = MSDNpage2

不幸的是,第一行会导致浏览器错误。以下代码:

WebBrowser1.ScriptErrorsSuppressed = True

我关闭了通知,但在这种情况下,源代码不会链接我关心的内容。因此,我请求您帮助解决这个问题。我认为自动点击“否”可能会有所帮助,但我找不到负责显示消息的流程。

1 个答案:

答案 0 :(得分:0)

我不知道如何设置属性,当我没有错误时,代码看起来像这样:

    <DIV id=serialInfoBox>
<DIV class=l>
<DIV class=progressBar>
<DIV class=o>
<DIV style="WIDTH: 0px" class=i></DIV></DIV></DIV><HGROUP>
<H2><A href="serial,stargate-universe.html">SGU Stargate Universe</A></H2></HGROUP></DIV>
<DIV class=r><IMG src="/static/serials/stargate-universe_small.jpg"> </DIV></DIV>
<DIV id=player>
<DIV id=player_2 hash="wZlV90mq4I3LgyGB6WGIgyKJvMzHhS2EvAGqhWmI25JIRMyrXIUnjAmAeIKJZqQJcIGBV1HInuKLuS2LnS1ZHWTMDqGrBk0FF9FAPSxMvuSJnAxLjZxHXy1IdSzEiSHJ1W1M" jQuery110007841996969566763="5"></DIV>
<DIV class=clearfix></DIV></DIV></DIV>
<DIV id=underPlayer><A class=l href="odcinek,stargate-universe,lost,s01e15.html">poprzedni odcinek</A> <A class=c watched="0" jQuery110007841996969566763="19">zaznacz jako obejrzane</A> <A class=r href="odcinek,stargate-universe,pain,s01e17.html">następny odcinek</A> </DIV>
<SCRIPT type=text/javascript>
        $(document).ready(function() {
            $('#langs li').click(function(e) {
                e.preventDefault();
                $('#players li').hide();
                $('#players li.'+$(this).attr('id')).show();
                $('#langs li').removeClass('active');
                $(this).addClass('active');
            });

            $('#player_2').click(function(e) {
                $.post("getVideo.html", {hash: $(this).attr('hash')}, function(data) {
                    $('#player').css('background','#000').css('text-align','center');
                    $('#player').html(data);
                    $('html, body').animate({
                        scrollTop: $("#player").offset().top-27
                    }, 1000);
                });
            });

            $('#players a.switcher').click(function(e) {
                e.preventDefault();
                $.post("getVideo.html", {hash: $(this).parent().attr('hash')}, function(data) {
                    $('#player').html(data);
                    $('html, body').animate({
                        scrollTop: $("#player").offset().top-27
                    }, 1000);
                });

            });

            $(document).on('click','a.tup',function(e) {
                e.preventDefault();
                var c_id = $(this).parent().attr('cid');
                $.post("commentVote.html",{cid: c_id, mode: "up"}, function(data) {
                    if (data >= 0) {
                        $('#cid'+c_id+' span').removeClass('red').removeClass('green').addClass('green');
                        data = '+'+data;
                    } else {
                        $('#cid'+c_id+' span').removeClass('red').removeClass('green').addClass('red');
                    }
                    $('#cid'+c_id+' span').html(data);
                    $('#cid'+c_id+' .tup').remove();
                    $('#cid'+c_id+' .tdown').remove();
                }) ;
            });
            $(document).on('click','a.tdown',function(e) {
                e.preventDefault();
                var c_id = $(this).parent().attr('cid');
                $.post("commentVote.html",{cid: c_id, mode: "down"}, function(data) {
                    if (data >= 0) {
                        $('#cid'+c_id+' span').removeClass('red').removeClass('green').addClass('green');
                        data = '+'+data;
                    } else {
                        $('#cid'+c_id+' span').removeClass('red').removeClass('green').addClass('red');
                    }
                    $('#cid'+c_id+' span').html(data);
                    $('#cid'+c_id+' .tup').remove();
                    $('#cid'+c_id+' .tdown').remove();
                }) ;
            });


            $('#underPlayer .c').bind('click', function() {
                var el = $(this);
                    if ($(this).attr('watched') == 0) {

                        $.ajax({type: "POST", url: "/reports,seen.html",timeout: 10000,data: "user=1075505&ep=38361", success: function(data) {
                                if (data == 1) {
                                    el.html('oznacz jako nieobejrzane').attr('watched','1');
                                }
                            }
                        });
                    } else {
                        $.ajax({type: "POST", url: "/reports,seen.html",timeout: 10000,data: "user=1075505&rem=1&ep=38361", success: function(data) {
                            if (data == 1) {
                                el.html('zaznacz jako obejrzane').attr('watched','0');
                            }
                        }
                        });
                    }
                return false;
            });

        })
    </SCRIPT>

并且没有我需要的链接,但是当我有链接时,我发现了错误,代码如下:

    <DIV id=serialInfoBox>
    <DIV class=l>
    <DIV class=progressBar>
    <DIV class=o>
    <DIV style="WIDTH: 0px" class=i></DIV></DIV></DIV><HGROUP>
    <H2><A href="serial,stargate-universe.html">SGU Stargate Universe</A></H2></HGROUP></DIV>
    <DIV class=r><IMG src="/static/serials/stargate-universe_small.jpg"> </DIV></DIV>
    <DIV style="TEXT-ALIGN: center; BACKGROUND: #000" id=player>
    <DIV style="POSITION: relative; WIDTH: 750px">
    <DIV style="Z-INDEX: 0; TEXT-ALIGN: center; WIDTH: 750px; BACKGROUND: #000; COLOR: #fff">
    <DIV class=embed>
    <DIV style="Z-INDEX: 0; POSITION: relative; WIDTH: 750px; HEIGHT: 429px; CLEAR: both"><SPAN id=aeceedb4c2667cf66b0cfe9780811fa6></SPAN></DIV>
    <SCRIPT type=text/javascript src="http://premium.iitv.info/static/player/flowplayer-3.2.11.min.js"></SCRIPT>

    <SCRIPT type=text/javascript>
                        $(document).ready( function(){
                            $f("aeceedb4c2667cf66b0cfe9780811fa6", "http://premium.iitv.info/static/player/flowplayer.commercial-3.2.15.swf", {
                                key: '#$3f90d28e7547ada6c98',
                                clip: {
here is url: --->                                    url: 'http://stream.streamo.tv/?scode=wZvoQAIH41HF5MxJiH2MAg0YeVKAFATnLMTGluyIl4HFeZyGCAUFhqGM5DREz9JnlM2MUAJEmq3HlSIBVgxq6OKqeRxHDATERSUZTAmqkHGn5cJA1yyZgA0pKcHDdAmMkRGZ2A2pfWKqeSKD4NUIQkRqVWwEIcRrLWmEKIaJbERnDgPFcW3A2RwAj52F6MUIgMyADImXjfvq2EKoMAJGxywD0y0Az50HeLmIy1zM0WTA19FBgWTIBc0FWWTAUAwrCuaEASKIiHQplWwMwMxZm9HZeO1FGMSHMSyELEwZaSRqXSHMjWmX6W2AUOUG2I2DmM0YU9RqjgFAiS0XLcJBDcJBQEQnLcJD142IaM0AL50nSOQJkkxEBSHrBMQBIOmM2qaqGgxo5SzJdAIpjymZ5bKLlyxrDuSokNyZ4ExZPqIJkVwpyqSZbMwZxITEjVIFyqSZIMaMPuUIeSxF5RSHzEQGIyTnIA3o2LwIJ1ToPE1DFyTpUqRqiHHpuSTF0RypBqmpacaG',
                                    provider: 'lighttpd',
                                    scaling: 'fit',
                                    backgroundGradient: 'none',
                                    autoPlay: false,
                                    autoBuffering: false
                                },
                                canvas: {
                                    backgroundColor:'#000',
                                    backgroundGradient: 'none'
                                },
                                plugins: {
                                    lighttpd: {
                                        url: 'flowplayer.pseudostreaming-3.2.11.swf',
                                                                            queryString: escape('?start=${start}')
                                                                        },
                                    controls: {
                                        url: 'flowplayer.controls-3.2.14.swf',
                                        autoHide: 'always'
                                    }
                                                                }
                            });
                        });
                    </SCRIPT>