Search code examples
javascriptinternet-explorermeteorcompatibility

Diverting users to a static Browser Not Supported page


At the moment I'm trying to build in my Meteor app a page to let the user know that their browser is not supported.

The problem is that my Meteor app doesn't even seem to load on IE6-9 at all. I just get a blank page.

What I'd like is that before it's all started, if I can direct them to just a static site telling them that their browser is unavailable.

This is what I have and it doesn't seem to be working

layout.html page

<template name="layout">

{{#if isOldBrowser }}
    {{> upgradeBrowser}}
{{else}}
<div class="{{iif currentUser 'padded' 'padded-top'}}">
    {{#unless getConfigSetting 'showLandingPageOnly' false}}
    {{> layoutNavbar }}
    {{> layoutConnectionStatus }}
    {{/unless}}
    {{> loginDialog }}
    {{> feedbackDialog }}
    {{> teamNameDialog }}
    {{> teamTimeDialog }}
    {{> teamAddParticipantDialog }}
    {{> teamEditParticipantDialog }}
    {{yield}}
</div>
{{/if}}

My global handlebars

Handlebars.registerHelper 'isOldBrowser', () ->
    BrowserDetect.browser == 'Explorer' && BrowserDetect.version < 10

My upgradeBrowser template

    <template name="upgradeBrowser">
<h1>Sorry mate! Your browser is a bit ancient! Try upgrading to <a href="www.google.com/chrome">Chrome</a></h1>
</template>

PS - i might also just mention that I'm only using the document mode setting in the developer tools built into IE11. It could so happen it might work but I really don't have any way to test it as I don't have an instance of an old version of IE


Solution

  • You can just drop in a third party package to handle that for you.

    I could recommend either one of https://atmosphere.meteor.com/package/redirect-ie-7-lower or https://atmosphere.meteor.com/package/browser-detection There is also a device detection package https://atmosphere.meteor.com/package/device-detection

    That being said, browser/device detection has lots of problems. They can be misleading or even spoofed and the general consensus around meteor community is that you should be doing a more modern approach such as graceful degradation or incremental improvements through feature detection.

    Have a read of this thread https://groups.google.com/d/topic/meteor-talk/ku7kvNJp8ek/discussion for different opinions.