Javascript - Degree Symbol
Browser Issues

While investigating issues related to placing the Degree Symbol (°) on a canvas, I identified several browser issues - details below.

As explained on the main page, the testcases were checked on 5 browsers - and 3 of them caused problems. None of these are directly related to what I was investigating but mainly "got in the way" of completing the main task.

MS Edge | MS IE11 | Chrome 63


MS Edge Design Problem

When the test page contained the following line (left over from debugging the UTF-8 problem), MS Edge 25 on Windows 10 refused to load the 2 associated javascript files. This comment was added by Chrome when it saved the original file that my application is based on.

This is pretty weird since this line has been present in all versions of my application for the last 2 years without any problems (that I know of). However, I only tested the application in MS Edge via the web (or a local web server) and never directly from a local disk drive. (Yes, it always works correctly when opened that way.) When tested locally, it had the same problem!!!

Besides removing the line (ok for the test file, but not in the application), the following "fixed" the problem.

As far as I'm concerned - This is a MS Edge design problem!

There is no way that anything in a properly formatted html comment should cause the browser to not load javascript files. None of the other test browsers I used had a problem with this - just MS Edge!

This was especially difficult to trouble shoot because

To be clear, I was opening the test page from either a networked file store (hard drive on another system) or the local c-drive - no html server was used. Yet, MS Edge continuously lost its mind.

One guess - Even though I was loading the page locally, MS Edge was trying to get the scripts from the remote site specified in the comment. Another possibility is that it was ignoring anything with a relative address. (Perhaps, a javascript security precaution.) At any rate, the debug window showed no error - the code was simply not loaded. Testcase


MS IE11 Design Problem

When the main html page was stored as ANSI, the results were dependent on how the page was opened. There are 4 Degree Symbols in the test table - 3 canvases and the code (text). My procedure was to open the file with MS Edge and to use the menu option to open the same file in Internet Explorer (IE11) - this never caused a problem.

After that, I would modify the html file's encoding (via notepad) and press F5 to reload the page. When the new encoding was ANSI, the first 2 canvases - Local HTML and ANSI js - and the text field displayed black diamonds - failure.

Repeated F5 and ctrl-F5 had no effect - the failure was still there.

When I closed IE, reopened it, and entered the url, it displayed all 3 Degree Symbols. Once the Degree Symbols were displayed, pressing refresh produced no change.

Once there was a failure, simply adding a space to the end of the url (in the address bar) and pressing enter (or clicking the arrow) caused the page to display correctly.

Inconsistent results like this are never acceptable! - Another Microsoft design problem - flaky software.

Based on the data, I think IE has a cache problem - it doesn't check the encoding type when refreshing the page. However, this only matters to people debugging a specific type of problem and is unlikely to be an issue for regular users.

To recreate this

Thus, it requires editing the file (changing the encoding of a file while it is displayed) to reproduce the error.


Chrome 63 Design Problem

When testing, Chrome 63 (on Windows 10) was the only browser (of 5) that failed to correctly display the Degree Symbol when the main html file was stored with ANSI encoding.

Text files encoded as UTF-8 are marked by placing 3 special characters at the beginning of the file. As a part of the process of developing the test page, and documenting what I learned, I place them in one of the gray comment boxes - similar to the one below. (The characters were copied from examdiff which makes them visible.) At that time, the testcases were also located in this file - they are now in separate files - and I tested various scenarios by modifying the encoding of this file - sometimes ANSI, other times UTF-8. As expected, since these 3 characters were no where near the beginning of the file, they were ignored by all the test browsers .. except Chrome 63! I have provided a separate test page so that you can see the problem yourself.

The example above contains an extra space, not included in a UTF-8 encoded file or on the test page. Without the space, Chrome 63 makes the characters invisible and then interprets the test page in the wrong way! Notice that not only are the 2 canvases rendered incorrectly, but also the Degree Symbol in the example code. (This image is actually from meta tag problem, but is identical to the Chrome 63 issue.)

Browser consistency is wonderful - too bad it doesn't exist!

I want to make it clear that this is a very specific problem that is not likely to show up in any web page except one trying to determine the cause of a problem (like this one). It is included here mainly for completeness and because it took a long time to figure out what was going on.

Just to confuse everyone (including me), after I uploaded these files to the web and tried them from there, there is no error - everything works as it should. Apparently, the problem only exists when displaying files from a local file store, not from the web.

When switching between testcases, sometimes there will be an error. Refresh (F5) has no effect, but ctrl-F5 reloads the same javascript files (no change in files) and the display will change.


Author: Robert Clemenzi
URL: http:// mc-computing.com / Languages / Javascript / Degree_Symbol / Degree_Symbol_browser_issues.html