Determining the browser being used to view course and display a message based upon that determination

Mar 24, 2020

Hello my friends,

I have a question that I've never had to think about but we have issues with people using our corporate install of IE11 with certain functions within our courses built in SL360.  We are recommending Chrome in all of our communications because everything seems to work without issue.

No matter how much we communicate, we get IT tickets asking for support and we usually determine they are using IE11 and by simply switching to Chrome, it fixes the issue.

Is there a way that when someone loads a course, that we can somehow check for the browser and version?  And say, its IE11, we display a message that effectively tells them what we would normally do over a phone call, email or screen share session. - This would save us so much time and right now we need all the time as I work for a hospital system and our resources are strapped but training must continue!

Thanks for any input!!

4 Replies
Brian Dennis

Javascript can be used to determine the browser. Well, at least the big three. Once you know the browser the javascript can set a project variable, which could be used on a subsequent slide for branching. I found some very promising leads (and code) searching the web for "javascript detect if chrome browser" just now. I would direct you to results from 2020, or late 2019 as the browser world changes frequently.

Johnrey Landoay

Hi Trace,

Brian is correct, this trick can be done by using a piece of Javascript code. So I actually went to find you the simplest code snippet you can use for your project. Just copy the entire code block below and paste it inside your story.html file just before the closing </body> tag. You can customize the alert message by replacing the words inside the alert parenthesis with your own alert message.

 <!-- Detect if browser is IE and display a message -->
<script>
var isIE;
(function() {
var ua = window.navigator.userAgent,
msie = ua.indexOf('MSIE '),
trident = ua.indexOf('Trident/');

isIE = (msie > -1 || trident > -1) ? true : false;
})();

if (isIE) {
alert("This course is best viewed on Google Chrome");
}
</script>

If you're not familiar with how to edit the story.html file don't worry because it's very simple and you can use any text editor to open the file for editing. If you have Windows then just use Notepad, otherwise, use any Notepad counterpart. Navigate to your Storyline project files and look for story.html then right click it, choose "Open With" then choose "Notepad" from the options.

When they load your course on IE, they get an alert message before they can continue. If they use any browser other than IE, they won't get any alert message.

I hope this helps and if ever you need further assistance, please don't hesitate to let me know.

Best of luck!

Regards,

Johnrey

Johnrey Landoay

Just a quick alternative, and I believe a much simpler way to add the Javascript code. Add a trigger on your first slide to execute the below Javascript code when timeline starts. I tried it and it worked.

var isIE;
(function() {
var ua = window.navigator.userAgent,
msie = ua.indexOf('MSIE '),
trident = ua.indexOf('Trident/');

isIE = (msie > -1 || trident > -1) ? true : false;
})();

if (isIE) {
alert("This course is best viewed on Google Chrome");
}

Cheers,

Johnrey