FLUID-4871: Updated check for browser environment. In addition to checki...

...ng for window object also checking for window.document since we create a stub window context in Node.js as well.