I have a Visualforce page that downloads XML content.

<apex:page applyBodyTag="false" applyHtmlTag="false" showHeader="false" contentType="application/vnd.google-earth.kml+xml" controller="PodKmlController" >
<kml xmlns="http://www.opengis.net/kml/2.2">
      <!-- ... -->

It works fine, except recently in testing it has started failing due to the following JavaScript being appended after the page content.

<script type="text/javascript">
    SfdcApp.Visualforce.viewstate.ViewstateSender.sendViewstate('https://ap2.salesforce.com', 'PodKmlExport');

This is invalidating the XML document.

Where is this extra JavaScript coming from?

1 Answer 1


Turns out this was only being appended when using the Developer Console to preview the Visualforce page.

When the developer console opens the page it appends the query string core.apexpages.request.devconsole=1. Removing that additional query string removes the offending JavaScript.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .