Added an error check to check for execution in a browser - gives a useful(ish) error