Static Page Caching 2.x

Legacy documentation for Static Page Caching 2.x.

Whenever a page is cached by Static Page Caching, any and all forms created from within ExpressionEngine will be displayed as they were when Static Page Caching cached the page. This means that if you have Secure Forms Enabled, the forms will not submit correctly because the secure hash hidden in the form will not be valid for the person viewing the page as ExpressionEngine was unable to create a new hash in the form for the person's IP Address.

A solution to this problem is to have javascript in the page that contacts ExpressionEngine and automatically replaces the hidden field containing the hash with a new, valid value. By putting this tag at the BOTTOM of your templates, Static Page Caching will output a script tag that will do exactly that.

NOTE: For security, the linked to javascript page has its code packed and encoded, while the javascript code itself will only work on forms that have an action="" attribute that submits to the same server as the linked javascript page.

Examples

Simply put this tag at the BOTTOM of your template before caching it and a <script> tag will be magically outputted

{exp:static_page_caching:refresh_secure_hash}

Example Output:

<script type="text/javascript" src="http://yoursite.com/index.php?ACT=60"></script>