I am trying to load an application built using angularjs and salesforce with offline capabality. For this functionality i am using Offline Caching Using the HTML5 manifest Attribute provided by salesforce.

I have created a CACHE-MANIFEST file as:

    <apex:page contentType="text/cache-manifest" applyHtmlTag="false" standardStylesheets="false" showHeader="false">

# Resources that require the user to be online.

{!URLFOR($Resource.Bootstrap, 'css/bootstrap.min.css')}
{!URLFOR($Resource.Stylesheet, 'main.css')}
{!URLFOR($Resource.Stylesheet, 'ng-table.min.css')}
{!URLFOR($Resource.Bootstrap, 'js/bootstrap.min.js')}    
{!URLFOR($Resource.AngularJSLib, 'angular.min.js')}
{!URLFOR($Resource.AngularJSLib, 'angular-route.min.js')}
{!URLFOR($Resource.AngularJSLib, 'angular-resource.min.js')}
{!URLFOR($Resource.AngularJSLib, 'ui-bootstrap-tpls-0.11.0.js')}
{!URLFOR($Resource.Bootstrap, 'js/bootstrap.min.js')}


I have referred the same in my main VF page as:

<apex:page controller="WorkOrderControllerExtension"  docType="html-5.0"  manifest="/apex/CacheManifestVF"
 sidebar="false" showHeader="false" standardStylesheets="false">

I am getting the following error:

Application Cache Error event: Failed to parse manifest and "the path of VF page"

What may be the problem?

2 Answers 2


So, while I was writing up code that demonstrates this, I found that Salesforce now includes a "view state" script that I couldn't figure out how to bypass. Thankfully, we can use # to cause the manifest parser to ignore the line. Here's the code I came up with:

<apex:page readOnly="true" standardStylesheets="false" showChat="false" contentType="text/cache-manifest" showHeader="false" 
           applyBodyTag="false" applyHtmlTag="false">CACHE MANIFEST

A few notes here to make sure everything turns out okay. First, the CACHE MANIFEST line must appear immediately after the apex:page's closing >, just to make sure that an errant blank line won't appear in front of the output.

Secondly, I included a # to force Visualforce into commenting out the extra code it insists on outputting. If anyone has a solution that doesn't involve commenting, I'd appreciate it if they added that information here.

The resulting output is as follows:

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

The problem is that it is hard/impossible to stop Visualforce from outputting extra content. For example this:

<apex:page contentType="text/cache-manifest" applyHtmlTag="false" standardStylesheets="false" showHeader="false">

produces this output:

    <body style="">
        <pre style="word-wrap: break-word; white-space: pre-wrap;">
        <div id="window-resizer-tooltip"><a href="#" title="Edit settings"></a><span class="tooltipTitle">Window size: </span><span class="tooltipWidth" id="winWidth"></span> x <span class="tooltipHeight" id="winHeight"></span><br><span class="tooltipTitle">Viewport size: </span><span class="tooltipWidth" id="vpWidth"></span> x <span class="tooltipHeight" id="vpHeight"></span></div>

instead of just this which is what the content type requires:


Using a static resource instead would give you full control of the content, but you would have to hard-code paths to the static resources; leaving out the resource version number might work but you would need to experiment. (You can get the sort of path needed by viewing the output of the failing Visualforce page.)

  • Even if i comment all resource path and just keep <apex:page> tag it gives the same error see below: <apex:page contentType="text/cache-manifest" applyHtmlTag="true" standardStylesheets="false" showHeader="false"> CACHE MANIFEST </apex:page>, Do you think i am missing something?
    – Ejaz
    Commented Mar 10, 2016 at 15:02
  • @Ejaz That is the point I was trying to make to you above: the <html><head>... etc is emitted whether you want it or not.
    – Keith C
    Commented Mar 10, 2016 at 15:04
  • There's two extra attributes you need to use: applyHtmlTag and applyBodyTag. They should both be set to false. It's perfectly possible to get plain text output, you just have to ask for it.
    – sfdcfox
    Commented Mar 10, 2016 at 15:14
  • @sfdcfox That sounds like an answer you should post...
    – Keith C
    Commented Mar 10, 2016 at 15:59
  • @Ejaz See sfdcfox's solution just above.
    – Keith C
    Commented Mar 10, 2016 at 16:15

You must log in to answer this question.

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