title: Determine whether the current Javascript implementation is Rhino
body: <p>I am using javax.script in Java, and I'd like to be able to detect whether the current Javascript implementation is Rhino. I'm doing this because I need to script to work properly on web pages as well as in Rhino.</p>
  
  <p>Javascript pseudocode:</p>
  
  <pre><code>function writeMessage(message) {
      if (implementation is Rhino) {
          print(message);
      }
      else if (script is running in a web browser) {
          document.write(message);
      }
  }
  </code></pre>