Developing in Chrome
Developing in Chrome requires knowledge to modify a few runtime settings and to get familiar with the Developer Tools.
Launching Chrome for CloudTV HTML5 Application Development
The default installation of Chrome does not have several features which will be required to develop an application and test in Chrome. Specifically, it lacks:
- "Remote data access" – Applications are installed in the data center, so access to data is needed across domains in order to access your web server or servers, such as graph.facebook.com.
In order to enable remote data access in your CloudTV applications, copy your shortcut to Chrome and add one launch parameter:
The easiest way to run Google Chrome with --disable-web-security is to run the following DMG, which is an automator script. Make sure to COMMAND+Q (QUIT) Google Chrome before running. (NOTE: you should never run any application other than your's in this instance of Chrome as it will allow cross-domain requests)
Create a new path to launch Google Chrome, identical to your current Chrome application launcher, but append the argument "--disable-web-security" to the argument list. To do this, open up Terminal and paste the following command. Make sure Google Chrome is not open, as this will need to be the only instance of Google Chrome running on your desktop at the time. This is the command:
nohup /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security --user-data-dir > /dev/null &
- Run the BAT file to exit chrome and launch a new instance with --disable-web-security (NOTE: you should never run any application other than your's in this instance of Chrome as it will allow cross-domain requests)
- Or create the bat yourself, it is very short:
taskkill /IM chrome.exe /F start chrome --disable-web-security --user-data-dir EXIT /B
Accessing the Developer Tools
Chrome offers a rich set of tools that aid in development of web pages and applications. Those familiar with the Firebug extension for Firefox will already know the benefits of having CSS, network inspector, and console tools available to you at run time. Chrome offers these features:
- Script Access – ability to add/remove breakpoints and step through code, introspecting on the call stack, scope variables, and a large group of standard debug tools familiar to developers who have used Zend Studio or Visual Studio.
To access the Developer Tools:
In Google Chrome:
- Click on the settings icon.
- Select "Tools" > "Developer Tools".