-4

I want that my website only open in chrome browser. It should not open in any other browser like uc browser ,firefox etc.

Jaydeep
  • 1,686
  • 1
  • 16
  • 29
Danish Danish
  • 43
  • 1
  • 1
  • 2
  • 8
    But _why_? This sounds like an XY-Problem. – tkausl Jul 08 '19 at 07:30
  • 1
    [Detect browser in Javascript](https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser) and load the content using Ajax. (You can't guarantee that it works 100% as JS can be fooled/modified) – Cray Jul 08 '19 at 07:30

1 Answers1

0

You can keep your launch function in below snippet which checks if browser is chrome or not.

if(/Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor)) {

}
Jaydeep
  • 1,686
  • 1
  • 16
  • 29
  • 1
    And users of other browsers can easily spoof the user agent. – Mr Lister Jul 08 '19 at 07:39
  • 1
    @MrLister everything can be spoofed on the website if we think that way.. – Jaydeep Jul 08 '19 at 07:41
  • 3
    That won't work, plenty of browsers which aren't Chrome include the string "Chrome" in their user-agent string **by default** because people do stupid stuff like this. – Quentin Jul 08 '19 at 08:17