xslt-1.0internet-explorer-11browser-cachehttp-status-code-304

IE - XSL files not getting loaded from browser cache (always hitting the server to load)


In our application, we have some pages where xsl transformation are happening using activex object Microsoft.XMLDOM. Its a legacy application, so there is not much scope for any changes.

Example:
<script>
var doc = new ActiveXObject("Microsoft.XMLDOM");
doc.async = false;
doc.load("/<<Some Path/myXSL.xsl");
document.write(myXML.transformNode(doc));
</script>

our HTTP server is sending correct cache-control, expiry attributes to the client end. The CSS, JS, Image files etc as we can see picked up from browser cache (status 304), but for XSL files, it is always hitting the server (status 200).

If we open the Temporary Internet Files, we can see although there is a future date is present against Expires column, but Last Checked is always getting updated against each request.

Any help here, would be much appreciated.


Solution

  • After searching a lot in google, we understood that ActiveX Microsoft.XMLDOM sends "pragma - nocache" in the request header (to skip the browser cache).

    To solve this, we need to set ForcedResync property as false (telling the XML Dom object not to send that pragma).

    Example:

    <script>
    var doc = new ActiveXObject("Microsoft.XMLDOM");
    doc.async = false;
    doc.setProperty("ForcedResync", false); 
    doc.load("/<<Some Path>>/myXSL.xsl");
    document.write(myXML.transformNode(doc));
    </script>