Validating and Testing Your Code
Once you've completed a page, you can use Dreamweaver to verify that the page is valid—in other words, that it follows the rules for its document type. You can validate page markup for any file, or validate XHTML and XML files as XML.
You can also use Dreamweaver to test your pages by verifying support for target browsers, testing for broken links, and generating reports.
Before you validate your pages, however, you need to use the Validator Preferences pane to configure your validation.
To select Validator preferences:
- From the Edit menu (Windows) or the Dreamweaver application menu (Mac), select Preferences. The Preferences dialog appears.
- Select the Validator category from the list on the left.
The Validator pane appears (
Figure 3.41
).
Figure 3.41 The Validator pane of the Preferences dialog.
- On the Validator pane, select languages to validate your pages against.
- Click the Options button to display the Validator Options dialog (
Figure 3.42
).
Figure 3.42 The Validator Options dialog.
- Deselect any Display options that you don't want the Validator report to include (all options are selected by default).
- Deselect any options that you don't want the Validator to check for (both options are selected by default). Both of these options pertain to character entities. If you want Dreamweaver to check for quotation marks and characters (&, <, and >) in your HTML, leave these options selected.
- Click OK to save your selections and close the Validator Options dialog.
- Click OK on the Validator pane to save your selections and close the Preferences dialog.
To validate markup:
- Open an HTML page in Dreamweaver.
- From the File menu, choose Check Page > Validate Markup, or press Shift-F6.
The Validator report displays on the Validation panel in the Results panel group at the bottom of the Dreamweaver workspace (
Figure 3.43
).
Figure 3.43 Choose Check Page > Validate Markup to display the Validator report in the Results panel group.
- If you want to view the full text of any error or warning in the Validator report, click the More Info button.
To validate as XML:
- Open an XHTML or XML file in Dreamweaver.
- From the File menu, choose Check Page > Validate as XML. The Validator report displays on the Validation panel in the Results panel group at the bottom of the Dreamweaver workspace.
Verifying support for target browsers
In addition to validating your pages, you can also test your code with a browser check in your choice of target browsers.
To verify support for target browsers:
- Open your page in Dreamweaver.
- On the Document toolbar, click the Check Browser button to the right of the title field (
Figure 3.44
).
Figure 3.44 Click the Check Browser button on the Document toolbar to open the Check Browser menu.
Figure 3.45 The Check Browser menu.
- From the Check Browser menu, select Settings. The Target Browsers dialog opens (
Figure 3.46
).
Figure 3.46 Select target browsers in the Target Browsers dialog.
- In the Target Browsers dialog, select the minimum version of each browser you want to use for testing your pages. Click OK to save your settings and close the dialog.
- Click the Check Browser button again to display the menu. Select Check Browser Support to test the open page.
- The results display on the Target Browser Check panel in the Results panel group (
Figure 3.47
).
Figure 3.47 View the browser-support results on the Target Browser Check panel.
Troubleshooting your code
You can also troubleshoot your code by checking your site for broken links and by using Dreamweaver reports.
To check for broken links:
- Open your page in Dreamweaver.
- From the Site menu, choose Check Links Sitewide, or press Ctrl-F8 (Windows) or Command-F8 (Mac).
- View the results on the Link Checker panel in the Results panel group (
Figure 3.48
).
Figure 3.48 View details on broken links on the Link Checker panel when you check links sitewide.
To use Dreamweaver reports:
- Open your page in Dreamweaver.
- From the Site menu, choose Reports.
The Reports dialog displays (
Figure 3.49
).
Figure 3.49 Choose Reports from the Sites menu to display the Reports dialog.
- In the Report On drop-down menu, select Current Document to test a single page, or Entire Current Local Site (if you have defined a Dreamweaver site).
- In the Select Reports section, select the items you want to test in the Workflow and HTML Reports sections.
- Click the Run button to run the report.
- View the report results on the Site Reports panel in the Results panel group (
Figure 3.50
).
Figure 3.50 View report results on the Site Reports panel.