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.
Javascript pseudocode:
function writeMessage(message) {
if (implementation is Rhino) {
print(message);
}
else if (script is running in a web browser) {
document.write(message);
}
}