Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script for Blocking All Chrome users? #5

Open
jalapenosxtra opened this issue Dec 15, 2019 · 1 comment
Open

Script for Blocking All Chrome users? #5

jalapenosxtra opened this issue Dec 15, 2019 · 1 comment

Comments

@jalapenosxtra
Copy link

jalapenosxtra commented Dec 15, 2019

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

@MeherDeepak-2005
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants