18.04.2016 Views

Professional JavaScript For Web Developers

javascript for learners.

javascript for learners.

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Safari (MacOS X)<br />

Error Handling<br />

Macintosh’s Safari browser has perhaps the worst support for <strong>JavaScript</strong> errors and debugging. By<br />

default, it offers no <strong>JavaScript</strong> error reporting to the end user. In order to enable error reporting, follow<br />

these steps:<br />

1. Open a command line shell.<br />

2. Execute the following: defaults write com.apple.Safari IncludeDebugMenu 1.<br />

3. Restart Safari.<br />

4. Under the Debug menu, check Log <strong>JavaScript</strong> Exceptions (Figure 14-6).<br />

5. Start Console.app under Application/Utilities.<br />

Figure 14-6<br />

After completing these steps, <strong>JavaScript</strong> errors are logged to the Console.app window (Figure 14-7).<br />

Unfortunately, the messages are less than useful without a URL or line number to help locate the cause<br />

of any given error. However, it is the best Safari can offer at this point.<br />

417

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!