Jay Rizzi
Jay Rizzi

Reputation: 4304

handling refresh using pushState or PJAX like github

I am attempting to build a treeslider to navigate on a site's content, and have had some success, i have a test page utilizing PJAX, a separate version using history.js, and a third version using jquery functions calling pushState/replaceState HTML 5 api

My issue is refresh handling, or direct link to a secondary page...if the original page has not been loaded, all that is displayed is the snippet

heres a pjax example: http://ur.nd.edu/pjax/

navigating to the links loads via pjax fine, but refreshing the page shows only the snippet, which i expect, i just want to know how to handle refreshes and direct links to include header formatting

gthub handles this beautifully, I just don't know where to begin

Upvotes: 0

Views: 1407

Answers (1)

Carl
Carl

Reputation: 1816

You need to update your server side code so that it returns the full html page (Wrapper and all) unless it is being requested via PJAX (in which case only return the content).

You can test whether the request has come from PJAX using code along the lines of:

if($_SERVER['HTTP_X_PJAX'] == 'true'){
//Return just content
}else{
//Return content within full HTML page
}

Upvotes: 1

Related Questions