Search code examples
javascriptcross-browseropera

How to determine the Opera browser using JavaScript


I want to determine whether the browser of the client machines is Opera using JavaScript, how to do that?


Solution

  • The navigator object contains all the info you need. This should do:

    navigator.userAgent.indexOf("Opera");