update export code to support both nw and chrome