JavaScript Console in Apple Safari

This section provides tutorial example on how to use the JavaScript Console in Apple Safari to view execution errors and log messages resulted from JavaScript execution. You can also use it to run any JavaScript statements to interact with the HTML document.

What is JavaScript Console in Apple Safari? JavaScript Console in Apple Safari is a console provided by the browser for you:

Here is what I did to test the JavaScript Console in Apple Safari:

1. Run Apple Safari and load the following HTML code:

<head><title>Hello World!</title></head>
<script type="text/javascript">
   document.write('Hello World! - Document');
   console.log('Hello World! - Console');

2. Press "Option-Command-C" key combination (or select "Develop > Show JavaScript Console" menu). I see "Console" tab on the developer panel displayed on the screen, with the log message displayed: "Hello World! - Console".

3. Enter some JavaScript statements in the console to run:

Hello World! - Console
>> var msg = document.title;
< undefined
>> console.log(msg.length);
< undefined

Cool. The console is nice tool to troubleshoot any issues with my JavaScript code in HTML pages running on Apple Safari.

JavaScript Console in Apple Safari
JavaScript Console in Apple Safari

Table of Contents

 About This Book

 Introduction to JavaScript

 ECMAScript Language Specification and JavaScript Dialects

 Data Types, Variables and Expressions

 Flow Control Statements

 Creating, Accessing, and Manipulating Arrays

 Defining and Calling Functions

Web Browser Supporting JavaScript

 JavaScript Support in Web Browsers

 Including JavaScript Codes with HTML "script" Tags

 type="text/javascript" or language="JavaScript"

 JavaScript Version Supported by Browsers

 Including 'script' Tags in String Literals

 Escaping 'script' Tags in String Literals

 Using HTML Entities to Protect HTML Tags

 Including JavaScript Codes as External Files

 DOM API - The "document" Object

 DOM API - The "window" Object

 DOM API - The "" Method

 Event Listeners and Objects

 'javascript:' Pseudo-URL Addresses

 JavaScript Console in Google Chrome

 JavaScript Console in Mozilla Firefox

JavaScript Console in Apple Safari

 JavaScript Console in IE (Internet Explorer)

 Server-Side and Client-Side Web Scripting

 Introduction to Objects

 Defining Your Own Object Types

 Inheritance of Properties and Methods through the Prototype Object Chain

 'jrunscript' - JavaScript Shell Command from JDK

 Using Functions as "Function" Objects

 Introduction to Built-in Object Types

 W3C's Document Object Model (DOM) Specifications

 AJAX (Asynchronous JavaScript And XML)


 Full Version in PDF/EPUB