Reputation: 127
My latest website relies heavily on the new features of Bootstrap 4/CSS and is simply unusable on old browsers that don't support it which apparently some of my users are still using...
What would be the best way for me to detect when a user's browser doesn't support bootstrap 4 so that I can either redirect them or show them a different page? (it's the detection I need help with, not the redirection)
I've found some similar solutions for older/different frameworks but I haven't found anything that works specifically with bootstrap 4.
My stack is a simple JS, PHP7 and BS4 if that matters.
I've heard of Modernizr but I've never used it and I don't know if that could do what I need? What would be the detection code I'd need?
Worst case scenario, if I end up needing to rely on the UserAgent (which I know isn't reliable and a terrible solution), are there any prebuilt solutions available so that I don't need to reinvent the wheel and code the detection from scratch myself?
Thanks!
Upvotes: 1
Views: 539
Reputation: 640
To detect the browser version I guess this answer can help you
[1]: https://stackoverflow.com/a/5918791/9350274
and you can redirect your users to a different page using a simple if else condition
Upvotes: 1