AdBlockDetection icon indicating copy to clipboard operation
AdBlockDetection copied to clipboard

Script for Blocking All Chrome users?

Open jalapenosxtra opened this issue 5 years ago • 1 comments

How can i ban every google chrome user from my website? Like anti adblock just 'Anti Google Chrome Browser' Like that the Chrome users getting an message that says'Change the browser to access this site' Thanks Regards

jalapenosxtra avatar Dec 15 '19 23:12 jalapenosxtra

@jalapenosxtra there is a way to check which client i.e., which browser is used for visiting the page

You can use javascript for that: var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;

// Firefox 1.0+ var isFirefox = typeof InstallTrigger !== 'undefined';

// Safari 3.0+ "[object HTMLElementConstructor]" var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && window['safari'].pushNotification));

// Internet Explorer 6-11 var isIE = /@cc_on!@/false || !!document.documentMode;

// Edge 20+ var isEdge = !isIE && !!window.StyleMedia;

// Chrome 1 - 79 var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);

// Edge (based on chromium) detection var isEdgeChromium = isChrome && (navigator.userAgent.indexOf("Edg") != -1);

// Blink engine detection var isBlink = (isChrome || isOpera) && !!window.CSS;

var output = 'Detecting browsers by ducktyping:


'; output += 'isFirefox: ' + isFirefox + '
'; output += 'isChrome: ' + isChrome + '
'; output += 'isSafari: ' + isSafari + '
'; output += 'isOpera: ' + isOpera + '
'; output += 'isIE: ' + isIE + '
'; output += 'isEdge: ' + isEdge + '
'; output += 'isEdgeChromium: ' + isEdgeChromium + '
'; output += 'isBlink: ' + isBlink + '
'; document.body.innerHTML = output;

I found the code in a stackoverflow answers : https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser

After you redirect your clients to specific url. Like chrome users to /chrome

You can block them or render a page which says 'Not Supported for chrome'

Just out of curiosity why do you wanna block chrome users ? Chrome is a widely used browser. One of the most popular

MeherDeepak-2005 avatar Sep 05 '21 04:09 MeherDeepak-2005