Detect ios opera mini with javascript
Detect ios opera mini with javascript
I need to block specific script from execution over IOS opera mini browser.
navigator.UserAgent does not allow to clearly identify this browser.
It returns somerhing like this: Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) OPiOS/8.0.0.78129 Mobile/11D201 Safari/9537.53
Ipad pro and iphone 5 se user agent not include nor 'opios' nor 'opr'
How to detect it correctly with javascript?
As @PatrickEvans said is better check feature detection, but if you want to check browser is better to test it with a regex some params, such as iPhone OS and OPiOS to avoid version changes.
– dloeda
Jun 13 '17 at 8:53
Note that Opera Mini client doesn't run JavaScript.
– LS_ᴅᴇᴠ
Jun 13 '17 at 9:46
1 Answer
1
The Opera Mini user agent on iOS can be identified by the string 'OPiOS'.
It's not possible (to my knowledge) to reliably feature detect for Chrome vs Firefox vs Opera on iOS because they're all forced to use UIWebView or WKWebView, so the features one might attempt to detect differences in are all identical.
Chrome & Firefox have adopted the same pattern, using 'CriOS' and 'FxiOS' respectively.
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
You probably want to do feature detection instead of browser detection, unless you have a specific reason for actually needing to know the browser
– Patrick Evans
Jun 13 '17 at 8:32