Active2 years, 8 months ago
For my website running on Wordpress, I want to block readers accessing it from UC Browser.. I have come across some scripts that can block the usual suspects (Chrome, Firefox, Safari, etc.). Is there a way I can detect UC Browser and block access via it?
Here are the details of UC Browser's User Agent:
Mar 23, 2019 Pendapatan situs Anda menurut dikarenakan banyaknya orang yang berselancar di internet menggunakan UC Browser atau AdBlock? Disini saya akan membagikan script anti AdBlock dan UC Browser. Dengan menggunakan script ini tentu akan membuat pengunjung situs atau blog kita mematikan AdBlock di browsernya. On the other hand, ad-block users typically run a myriad of script. In WordPress, the anti-adblock plugin can be used to do just that.
![Anti Anti](/uploads/1/2/5/2/125281696/869173570.jpg)
How can this be done?
Michał Perłakowski50.3k1616 gold badges115115 silver badges132132 bronze badges
Shalin Tejpal JainShalin Tejpal Jain
3 Answers
Use following
.htaccess
file:It will block any browser which send
User-Agent
header containing string UCBrowser
.If you want to redirect all UCBrowser users to specific page, for example showing information that this browser is not supported, your
Michał PerłakowskiMichał Perłakowski.htaccess
should look like this:50.3k1616 gold badges115115 silver badges132132 bronze badges
It is somewhat 'simple', but not 'too simple'.
You may detect the browser using JavaScript Window Navigator. The window.navigator object contains information about the visitor's browser.
Refer here http://www.w3schools.com/js/js_window_navigator.asp and you will find a demo here https://jsfiddle.net/wvbdnb8o/ which detects some common browsers using some code like;
Next, create a 'mask' using html and css. I mean, A full screen, opaque
<div>
, that prevent readers from viewing the contents of page. You may refer this stackoverflow post How to make a <div> always full screen?.When you detect UC Browser, display the mask, else, hide it. Hope this will give you a kick start.
blasteralfred Ψblasteralfred Ψ13.1k4747 gold badges145145 silver badges212212 bronze badges
Please Try this, this script will blocked old and latest all UCBrowser and redirect to custom page
Jon Clements♦106k2020 gold badges192192 silver badges225225 bronze badges
Acharya RaiAcharya Rai