Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions jquery.pjax.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,17 +252,15 @@ function pjax(options) {
locationReplace(container.url)
return
}

pjax.state = {
id: options.id || uniqueId(),
url: container.url,
title: container.title,
container: context.selector,
fragment: options.fragment,
timeout: options.timeout
}

if (options.push || options.replace) {
pjax.state = {
id: options.id || uniqueId(),
url: container.url,
title: container.title,
container: context.selector,
fragment: options.fragment,
timeout: options.timeout
}
window.history.replaceState(pjax.state, container.title, container.url)
}

Expand Down Expand Up @@ -318,7 +316,7 @@ function pjax(options) {
// using the container and options of the link we're loading for the
// back button to the initial page. This ensures good back button
// behavior.
if (!pjax.state) {
if ((options.push || options.replace) && !pjax.state) {
pjax.state = {
id: uniqueId(),
url: window.location.href,
Expand Down Expand Up @@ -439,6 +437,7 @@ function onPjaxPopstate(event) {
url: state.url,
container: container,
push: false,
replace: true,
fragment: state.fragment,
timeout: state.timeout,
scrollTo: false
Expand Down