diff --git a/h2o-algos/src/main/java/hex/tree/SharedTreeModel.java b/h2o-algos/src/main/java/hex/tree/SharedTreeModel.java
index <HASH>..<HASH> 100755
--- a/h2o-algos/src/main/java/hex/tree/SharedTreeModel.java
+++ b/h2o-algos/src/main/java/hex/tree/SharedTreeModel.java
@@ -126,6 +126,20 @@ public abstract class SharedTreeModel<M extends SharedTreeModel<M,P,O>, P extend
   }
 
   // Override in subclasses to provide some top-level model-specific goodness
+  @Override protected boolean toJavaCheckTooBig() {
+    // If the number of leaves in a forest is more than N, don't try to render it in the browser as POJO code.
+    try {
+      if ((this._output._treeStats._num_trees * this._output._treeStats._mean_leaves) > 5000) {
+        return true;
+      }
+    }
+    catch (Exception ignore) {
+      // If we can't figure out the answer, assume it's too big.
+      return true;
+    }
+
+    return false;
+  }
   @Override protected SB toJavaInit(SB sb, SB fileContext) {
     sb.nl();
     sb.ip("public boolean isSupervised() { return true; }").nl();
Added a 'preview' flag to GET Model so the browser can tell the backend when
it's requesting a java pojo.  Don't render the full thing if it's huge and
will kill the browser.