User Guide > Tasks > Working with Plugins > Debugging JavaScript

Debugging JavaScript

The Zend Studio JavaScript debugging function allows you to test your files and applications and detect errors in your code. These procedures describe how to debug JavaScript code live from your workspace using an internal JavaScript Debugger.

Debugging JavaScript in an HTML File

This procedure describes how to debug JavaScript code that is in an HTML file.  To open an HTML file go to File | New | HTML Page.

 

 

Instructions on how to complete a procedure

To debug JavaScript in an HTML file:

  1. To open the PHP perspective go to Window | Open Perspective | PHP.
    The PHP perspective opens.

  2. In your project directory select  Debug As | Debug JavaScript from the Right Click Menu.
    The "Confirm Perspective Switch" dialog opens to inform you that the launch will open the Debug Perspective.

  3. Click Yes.
    The Debug Perspective opens.

Debug Perspective

  1. From the Scripts view double click a script from the list of available scripts.
    The script opens in the editor.

  2. In the editor, set breakpoints at the relevant places in the file by double-clicking the vertical marker bar to the left of the editor.

  3. Save the file.

  4. Click  Resume Icon in the Debug View to start debugging.

Use the controls in the Debug view to manage your debugging session.

A number of views will open with relevant debug information.

See the Running and Analyzing Debugger results topic for more information on the outcome of a debugging process.

Note:

If the file contains 'include' or 'require' calls to files which are not contained within the project, you must add them to the project's Include Path in order to simulate your production environment.

Debugging a URL

This procedure describes how to debug a URL. This allows you to debug code according to a URL instead of a file name.

 

 

Instructions on how to complete a procedure

To Debug a URL:

  1. From the menu bar select Run | Run Configurations - or - From the Right Click Menu in your project directory select Run As | Run Configurations.
    The "Run Configurations" dialog opens.

Run Configurations Dialog

  1. Double click the Web Application node to create a new debug configuration.

  2. Open the Web Configuration tab.
    In the "Debug Target" field select "URL".

  3. In the empty text field enter the complete URL.

  4. Click Apply to apply the changes.

  5. Click Debug to debug the URL.
    The URL opens in the Internal Web Browser and the debugging process begins.

A number of views will open with relevant debug information.

See the Running and Analyzing Debugger results topic for more information on the outcome of a debugging process.

 

 

Related Links:
JavaScript Debugging

Ajax Tools

Working with the Web Browser

Debugging JavaScript

Debug Perspective

Web Browser Tools Perspective

 

 

©1999-2013 Zend Technologies LTD. All rights reserved.