Skip to content

Commit 9ce916f

Browse files
committed
Doc it
1 parent 3b7a4a3 commit 9ce916f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,26 @@ An `X-PJAX` request header is set to differentiate a pjax request from normal XH
243243

244244
Check if your favorite server framework supports pjax here: https://gist.github.com/4283721
245245

246+
#### Layout Reloading
247+
248+
Layouts can be forced to do a hard reload assets or html changes.
249+
250+
First set the initial layout version in your header with a custom meta tag.
251+
252+
``` html
253+
<meta http-equiv="x-pjax-version" content="v123">
254+
```
255+
256+
Then from the server side, set the `X-PJAX-Version` header to the same.
257+
258+
``` ruby
259+
if request.headers['X-PJAX']
260+
response.headers['X-PJAX-Version'] = "v123"
261+
end
262+
```
263+
264+
Deploying a deploy, bumping the version constant to force clients to do a full reload the next request getting the new layout and assets.
265+
246266
### Legacy API
247267

248268
Pre 1.0 versions used an older style syntax that was analogous to the now deprecated `$.fn.live` api. The current api is based off `$.fn.on`.

0 commit comments

Comments
 (0)