WebBrowser control does not complete loading when javascript:void(0) called

只谈情不闲聊 提交于 2019-12-11 06:36:24

问题


I have an application in C# which uses a WebBrowser control.

On one page the user can click a button to process some information and navigate to a new page. The issue is that when the user clicks this button the WebBrowser just seems to stop.

I handle the Navigating, Navigated and DocumentCompleted events in my code and I see the Navigating event but then nothing else.

This is the HTML for the button being clicked:

<div class="right button-wrapper">
    <div class="clearfix right">
        <span id="nextbutton" 
              class="button-link button-link btn-reg btn-blue-reg">
            <span class="hasHover"><a id="btnPay" 
                href="javascript:void(0);" class="buttons">Next:Pay and Print</a>
            </span>
         </span>
    </div>
</div>

Buttons on other pages can be clicked with no issues.

I am assuming it has something to do with the href="javascript:void(0);" portion of the HTML but do not know why. In a browser such as IE or Firefox when this button is clicked something like a progress bar appears and say "Processing" for a few seconds and then the next page loads.

EDIT:I should mention that the Navigating handler fires twice and then the page freezes.


回答1:


This is apparently caused by IE7+'s "Script URL Mitigation" feature and can be fixed for your application by disabling FEATURE_SCRIPTURL_MITIGATION.



来源:https://stackoverflow.com/questions/10226589/webbrowser-control-does-not-complete-loading-when-javascriptvoid0-called

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!