How to solve this problem?
However, i don't want to lost my visitor event they used UCBrowser so then I make a script to tell the visitor to use different mobile browser to read the full article.With this script, user who use UCBrowser on theiy mobile devices able to open or read my article on the blog, but after 30 sec the page will changed (not redirect) by the alert or notes to tell to the user to used different mobile browser for the full article.
How to redirect page if user used UCBrowser user-agent
UCBrowser will block or hide your ads, so that why people say they user-agent is the fastest mobile browser.To make all visitors who use UCBrowser redirected to another page, you can use the following script
<script>if (navigator.userAgent.match(/UCBrowser/i)) {
location.href("http://www.yourdestinationurl.com");
}
</script>
But, how to make redirect all page to one page in same domain on UCBrowser?
In this case you have to write some or part of the url destination, see at the example below :
JavaScript
Target page : http://yourdomain.com/my-redirect-page.html, Then if you want to redirect all page to one page, but don't do this at the target page, use this script :<script>
if (navigator.userAgent.match(/UCBrowser/i)) {
if (window.location.href.indexOf('my-redirect-page.html') > -1){ // do nothing
} else {
location.href("http://www.yourdestinationurl.com"); }
}
</script>
Now, how to Redirect Page if visitor used UCBrowser by PHP script
Simple way...<?php
if(preg_match("/UCBrowser/i",$_SERVER["HTTP_USER_AGENT"])) {
header('Location:yourpage.php');
exit();
}
?>
Labels: Blogger, Internet browser, javascript, Mobile Browser, useragent