Web Console
B-1. Web Browsers
For all the chapter examples, I used the browsers listed in Table B-1 to test the code. Screen shots are taken from the Firefox browser. If there are significant differences in display or behavior in other browsers, I have mentioned this.
Table B-1. Web Browsers Used for Testing
B-2. Using the Web Console
In your JavaScript and jQuery code, you can the use console.log() statement to log messages in the web console. This is a better alternative to alert() because it doesn’t impact the developer or user experience and you have a choice to see or ignore logged messages. It is highly recommended that you remove informational console.log() statements before deploying to production to prevent any performance-related issues. I highly recommend you keep the web console active so that you can quickly identify any JavaScript syntax and runtime errors.
The following sections explain the ways to start the web console in different browsers.
B-2-1. Starting the Web Console in Firefox (Windows)
To start the web console in the Firefox browser, use the Ctrl-Shift-K shortcut key or follow the steps outlined in Figure B-1 (choose Firefox Web Developer Web Console).
Figure B-1. Starting the web console in the Firefox browser
B-2-2. Starting the Web Console in Chrome (Windows)
To start the web console in the Chrome browser, you can use the F12 (or Ctrl-Shift-I) shortcut key or follow the steps shown in Figure B-2 (choose the Customize and Control Google Chrome Icon at top-right corner Tools Developer Tools).
Figure B-2. Starting the web console in Google’s Chrome browser
After that, click on the Console tab.
B-2-3. Starting the Web Console in Internet Explorer (Windows)
To start the web console in the Internet Explorer browser, you can use the F12 shortcut key or follow the steps shown in Figure B-3 (choose Tools at the top-right corner F12 Developer Tools).
Figure B-3. Starting the web console in the Microsoft Internet Explorer browser
Then click on the Console button .
B-2-4. Starting the Web Console in Safari (Mac OS)
By default, the developer tools are not turned on in Safari, so make sure to turn them on from the Preferences menu. Choose the Advanced tab and then check the Show Desktop Menu in Menu Bar option. Figure B-4 shows how to enable the developer tools in Safari.
Figure B-4. Enabling the developer menu in Apple’s Safari browser
To start the web console in the Safari browser, you can use the Command-Option-C shortcut key or follow the steps outlined in Figure B-5.
Figure B-5. Starting the web console in Apple’s Safari browser
18.226.104.27