Browser module check

Checking for module existence produced "Uncaught ReferenceError: module is not defined". Checking if the type of module is not "undefined" fixes this problem.