How to overcome Script Error in CHtmlView?

。_饼干妹妹 提交于 2021-01-24 11:35:37

问题


I am using CHtmlView to show HTML pages from online into my application. Whenever the site/page tries to load any '.js' file or script it throws Script Error dialog and unable to load few items from the page. I have made SetSilent(TRUE) to avoid error messages, but still the Script Error occurs without showing the dialog. How can I overcome this problem?


回答1:


To avoid JavaScript errors, one must create a value in registry edit under the following registry path,

32-bit : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION

64-bit : HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION

value name : your application name(eg: sample.exe)

value : refer to this page




回答2:


Editing the registry will suspend all alert messages. There is another way to avoid error alerts in your web page. Just add the following codes in the page:

<script type="text/javascript" >
    function fnOnError(msg,url,lineno){
        return true;
    }
    window.onerror = fnOnError;
</script>


来源:https://stackoverflow.com/questions/22652097/how-to-overcome-script-error-in-chtmlview

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