Use requirejs and try to isolate chrome-specific code.