1

This is actually my first question on Stack Overflow, so i'm quite excited.

Question: I made a game that requires Flash to operate. I would like to show a message to visitors of the website with a browser that is not Chrome.

It would be a string: "If the game is not loaded correctly, try using Google Chrome".

If you guys would know a way to show this message when not visiting with Google Chrome (because that would be a bit redundant), I would greatly appreciate it!

Tycho Horn
  • 55
  • 5

1 Answers1

3

You can detect browser and if it's chrome make it hide:

if(/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())){
$('#Msg').hide();
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<div id="Msg">Hello!!!</div>
Pedram
  • 15,766
  • 10
  • 44
  • 73
  • Unfortunately this will also match Microsoft Edge, since it has 'Chrome' in the user agent string. Example: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240` – Jesper Rønn-Jensen Jan 20 '17 at 11:10