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:
How can this be done?
Use following
.htaccess
file:It will block any browser which send
User-Agent
header containing stringUCBrowser
.If you want to redirect all UCBrowser users to specific page, for example showing information that this browser is not supported, your
.htaccess
should look like this:Please Try this, this script will blocked old and latest all UCBrowser and redirect to custom page
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.