2

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?

HariDev
  • 508
  • 10
  • 28
  • This is not an answer, but I believe that the instance of IE embedded in the CHTMLView runs with increased security that may disable javascript. – user1793036 Mar 27 '14 at 01:12

2 Answers2

2

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

HariDev
  • 508
  • 10
  • 28
  • What was the solution? The MSDN web page might have changed and I don't know what value to use. – Louis Nov 11 '16 at 17:07
  • @Louis I guess you did not go through properly. The page clearly says what value should be used. Check out the "Browser Emulation" in the page. – HariDev Nov 14 '16 at 04:44
  • I'm looking at the link, I don't see what value to use to stop the javascript errors either? – df234987 May 20 '20 at 01:08
  • @HariDev If your application is x64 do you still need to use the Wow6432Node or is that only for x86 apps running on Windows x64 ? – df234987 May 20 '20 at 03:40
  • @df234987 those are values that emulate the mentioned browser version on the HTML view on your application. If I still remember correctly, the application was targeted for x86. Currently, I'm not working on this. – HariDev May 22 '20 at 03:57
0

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>
Hank Chang
  • 199
  • 2
  • 10