3

I have a wallboard setup to display statistics in the office, however the widget that uses embedded Internet Explorer keeps coming up with a JavaScript error.

enter image description here

The error can be closed without causing problems but it's irritating as it keeps coming back every so often around 2-3 times a day, and when it does it stops anyone from viewing statistics till it's closed by remotely accessing the wallboard. In regular Internet Explorer this can be easily stopped by unticking the option below.

enter image description here

My question is how to disable this script error pop-up in the Internet Explorer that's embedded into my widget?

Edit: Response to answer from harrymc

I have now edited these settings using regedit as per harrymc's instructions, however the error still pops up.

  • 2
    Are you saying the wallboard doesn't give you access to the Internet Settings? Also, the JS error is fairly easy to fix. It is missing a check in the code to cope with a null or undefined variable. – Julian Knight May 15 '15 at 19:24
  • Unfortunately I don't have access to the code, it's all built in so that all I can change is basic settings. I can change browser settings on the wallboard but the embedded IE seems to use separate settings – man-qa May 18 '15 at 15:26
  • can you edit the registry of the machine? You may be able to set the IE control panel option via the registry? – Kinnectus May 18 '15 at 15:39
  • I can edit the registry though I'm unsure which is the correct option in regedit (there's a lot for IE) and once I find it what do I change it to? – man-qa May 18 '15 at 16:00
  • Why don't you just correct the JavaScript to resolve the error? – Ramhound May 19 '15 at 11:08
2

As you can edit the registry, the following article lists many IE settings :
How to Customize Virtual Internet Explorer Settings.

To disable "Display a Notification about Every Script Error", use the following .reg file :

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"Error Dlg Displayed On Every Error"="no"
  • Hi harrymc, please see my response above – man-qa May 19 '15 at 10:13
  • Never mind I think I worked it out now. the registry you were on about wasn't on the wallboard but it was on my pc, so I exported it and copied it over, just have to wait and see if the error comes back now – man-qa May 19 '15 at 10:45
  • Sigh, the error still comes up even with the registry changed – man-qa May 19 '15 at 10:56
  • You might need to reboot. – harrymc May 19 '15 at 11:44
  • I restarted the software, do you mean the whole wallboard pc? – man-qa May 19 '15 at 13:27
3
+100

In this specific case, rather than trying to hide the error, you might be able to avoid it altogether (or point your supplier to this post to fix their JavaScript):

  • Maybe the server returns no value at all for the "opened tabs" in the JavaScript below; try to change the widget's tabs settings to force the server to set some value. If you cannot do this in the wallboard, then try in a regular browser, hoping such would save the settings to the server.

When this doesn't help, try the following in a "regular" Internet Explorer browser:

  • Maybe the domain of the URL you're using is different from the one from which the script is loaded (or: the URL from which the widget loads its HTML or data), making IE feel it's handling a third-party cookie. So: see what allowing third-party cookies gets you. See Microsoft's Block, enable, or allow cookies.

  • Maybe setting or reading cookies in JavaScript needs some additional rights. So: see if adding daviker.whccs.com to the trusted sites helps, to allow it to do a bit more? See Microsoft's Security zones: adding or removing websites.

  • Maybe the server has already set a cookie with the same name, but marked it as HttpOnly, making it inaccessible from JavaScript. Try deleting any existing "active-tabs" cookie.

Background:

The error on line 1546 of the script is related to a specific cookie not being available to that script, right after the very same script tried to set/change that cookie itself (on line 1541, where its value might actually be undefined as line 1533 fails to check for that):

1527    restoreTabsFromTheServer: function()
1528    {
1529        $.post("xrm_ui?get=getTabs", {}, function(responce) {
1530
1531            reportTabs.tabCaptions = responce.reportPages;
1532
                // Next line only checks for an empty "openedtabs", not for
                // an undefined or null value; bad coding...
1533            if (responce.openedtabs == '')
1534            {
1535                $.cookie("active-tabs", '');
1536                reportTabs.tabidSelected = undefined;
1537                reportTabs.tabindexSelected = undefined;
                    // Next line would exit the function if we had an empty
                    // result, but not if it is undefined or null
1538                return false;
1539            }
1540
                // Next line: NO ERROR WHILE WRITING, but the new value could
                // be undefined, which might even clear an existing cookie?
1541            $.cookie("active-tabs", responce.openedtabs);
1542            reportTabs.tabidSelected = responce.tabidselected;
1543            reportTabs.tabindexSelected = responce.tabindexselected;
1544
1545            // restore tabs
                // Next line: NO RESULT WHEN READING
1546            var arr = $.cookie("active-tabs").split(',');
1547            ...

So, it seems that the embedded IE is ignoring the JavaScript setting that cookie, or the JavaScript sets the cookie to be undefined. And then when trying to read back its value it's empty.

I don't know if the embedded IE component uses the "regular" IE browser settings for cookies. But I have surely seen embedded IE components share cookies with the IE browser. (Like when clicking links in Excel when IE is not the default browser, IE cookies are still used for some discovery.) So, maybe changing the settings in the "regular" IE browser will allow JavaScript to set this cookie in the embedded component.


Alternatively, maybe the value that is received from the server in line 1529 is not a valid value, making the writing or reading fail. Like commas are not allowed in cookies, so the .split(',') looks suspicious. But then: we don't even know which jQuery plugin is used for $.cookie, so we'd need much more detail to figure out if it is using some encoding.

  • 1
    I wish i could aware bonus points for trying to solve the problem instead of a symptom ( i.e. not loading the script or just ignoring the error). – Ramhound May 19 '15 at 14:47
  • Thanks, @Ramhound. On the other hand, maybe my answer is far too specific for a Stack Exchange Q&A site (as for the chance that a future visitor will have the same problem)... – Arjan May 19 '15 at 14:58
  • Your answer wasn't the one that I used but it was a lot better :p – man-qa May 22 '15 at 14:53
  • Ah, when not having provided any credentials, a GET to xrm_ui?get=getTabs yields null rather than an empty string like for the other values: {"openedtabs": null, "tabindexselected": "", "tabidselected": ""}. Maybe the same happens when the script executes the POST, presumably with a proper authenticated session. – Arjan May 24 '15 at 22:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.