Duck-Typing and a Homepage Warning for IE11

Posted on Updated on

During a testing phase on one of our current clients we encountered an issue where some HCM Cloud pages weren’t displaying correctly to users who used the Internet Explorer browser.

This presented us with a problem, as Microsoft no longer really support IE11 (recommending Edge instead) and some users weren’t even on the latest release, having versions as far back as IE6 – which has been outdated for at least 15 years. With it not being supported by MS it’s not fair to expect Oracle to fix the issue. We cannot force all users away from IE as although the company could mandate a more modern default browser via AD group policy we cannot control what users choose to have on their personal laptops.

So it was decided that we would still allow users with IE11 and prior versions to access HCM Cloud, but to place a warning on the homepage to inform them that they’d get a better experience on a more modern browser. We obviously don’t want to trouble users of other browsers with this message however.

Identifying Browsers / Duck-Typing?

A little research on identifying browsers via Javascript led me to understand that checking the browser’s user agent string is not reliable. The best-rated solution on Stack-Overflow uses a technique amusingly called duck-typing. This uses a duck test—“If it walks like a duck and it quacks like a duck, then it must be a duck”—to determine if an object can be used for a particular purpose. In this case, instead of querying the browser user agent (essentially expecting the browser to accurately describe itself), duck typing tests how the browser behaves. If it behaves in the way we know IE browsers behave, then it must be IE etc.

Here’s the Stack Overflow answer.

Displaying a warning for only Internet Explorer users

Now we can identify IE users, we need to display a message to them.

First I decided where the warning would look best, deciding on just below the welcome greeting. I copied the name of this div for later use.

Within a Sandbox I used Page Composer to edit the springboard. I added an HTML Markup object and named it ‘IE11 Warning’.

Within the HTML Markup I added content that contained some javascript that appended to the greeting div with the warning only for users that we’d identified as IE11 via duck-typing.

The End Result:

It works a treat, displaying for IE users and not for anyone using other browsers.

IE11 warning

Advertisement