I am working on a react application and customers want it to show a special message if user's old browser does not support (e.g. IE 9).
So long I tried to detect some "popular" old browsers, using react-device-detect
package.
src/index.js
import { browserName, browserVersion } from "react-device-detect";
const render = Component => {
if (browserName === "IE" && browserVersion < 10) {
ReactDOM.render(<UnsupportedBrowser />, document.getElementById("root"));
} else {
ReactDOM.render(
<AppContainer>
<Component store={store} history={history} />
</AppContainer>,
document.getElementById("root")
);
}
};
And putting conditional comments:
public/index.html
<!--[if lte IE 9]>
Please upgrade your browser
<![endif]-->
But I have a suspicion, that there are better ways of doing it, which I could not find searching the web.