Use Administrator Preview Mode to Troubleshoot Salesforce Sites

If you see errors on site pages and you can't determine the cause, use administrator preview mode to look at them in context and in greater detail.

Required Editions

Available in: both Salesforce Classic and Lightning Experience
Available in: Developer, Enterprise, Performance, and Unlimited Editions
User Permissions Needed
To create and edit Salesforce Sites: Customize Application
Note
Note Administrator preview mode is available for all active sites, including those with a branded custom Web address.

To access administrator preview mode:

  1. From Setup, enter Sites in the Quick Find box, then select Sites.
  2. Click the name of the site you want to preview.
  3. In the Site Detail section, click the Preview as Admin link. A new browser window opens with a preview of your site, and the enhanced error message appears at the bottom of the page.
  4. Click Logout of Administrator Preview Mode to clear the administrator cookie and be redirected to the site's home page.

The detailed error messages in administrator preview mode are driven by the <site:previewAsAdmin /> component in your Visualforce error pages. Starting with Summer '10, new organizations include the <site:previewAsAdmin /> component by default in standard error pages. You must add the component manually to all custom error pages and pages from older organizations. We recommend that you add it right before the closing </apex:page> tag, like this:

    <site:previewAsAdmin />
</apex:page>
Note
Note The <site:previewAsAdmin /> component contains the <apex:messages /> tag, so if you have that tag elsewhere on your error pages, you will see the detailed error message twice.