1

In some browsers (ex ie7) where angular is not working I want to display a message telling the user to have his browser updated or use another one.

The way I am doing this is

<div ng-if="false">Browser not supported</div>

If the angular cannot render then the ng-if will not be processed so the div is displayed.

This is also causing a flicker when testing for pages with protractor because the protractor is going from page to page very fast.

My question is: Does anyone have a better solution of treating this kind of situation?

Blitz
  • 249
  • 3
  • 16
  • First of all don't promote old browsers and expect new things.Its better to move on and only use new browsers :-D – squiroid Feb 19 '15 at 16:32
  • Check this topic - http://stackoverflow.com/questions/12709745/angular-routing-not-working-in-ie7/12891208#12891208 – vtor Feb 19 '15 at 16:35
  • You could use [modernizr](http://modernizr.com/) for feature detection before even loading angular or you could use vanilla JS to sniff the UA using navigator and if IE7 do something (using feature detection is preferred over UA sniffing in general though). – masimplo Feb 19 '15 at 16:52
  • @squiroid, @vtorosyan: I'm not promoting legacy browsers but i`m trying to find a fix so that users don't have an unpleasant experience if their browser does not support angularJS (not only IE7 but also small browsers that don't support this like android default browser). And mainly, you cannot force a user to change it's behavior based on your product, it's you who has to align to the market if you wish to be a valid competitor – Blitz Feb 20 '15 at 14:48
  • @mxa055 there must be a more elegant solution that to use a plugin to display that angular has broken but your solution seems to work. hopefully someone will find a more elegant way of doing this. thanks – Blitz Feb 20 '15 at 14:50
  • @Blitz You are using a feature detection script to detect that the browser does not support a needed feature for your application to even run. I think it is much more elegant than having your application to check if it can run on the given environment, especially if that is not even remotely possible. – masimplo Feb 20 '15 at 17:00
  • I like your proposition, the only problem I see is that the message _"Browser not supported"_ will be shown for compatible browsers until Angular is loaded and initialized :/.. I'm trying to figure out a way to this not to happen. – fguillen May 21 '15 at 12:10

0 Answers0